17 lines
385 B
Python
17 lines
385 B
Python
import yaml
|
||
|
||
lines = []
|
||
with open("/tmp/nezha-config-raw.yaml") as f:
|
||
for line in f:
|
||
if not line.startswith("custom_code"):
|
||
lines.append(line)
|
||
|
||
config = yaml.safe_load("".join(lines))
|
||
|
||
# 不加 custom_code,恢复默认
|
||
|
||
with open("/tmp/nezha-config-fixed.yaml", "w") as f:
|
||
yaml.dump(config, f, allow_unicode=True, default_flow_style=False)
|
||
|
||
print("done")
|