| 480 | } |
| 481 | |
| 482 | static void create_setconfig_include(struct lightningd *ld) |
| 483 | { |
| 484 | const char *lines; |
| 485 | time_t now = time(NULL); |
| 486 | const char *fname; |
| 487 | bool must_exist; |
| 488 | |
| 489 | /* Usually config.setconfig, but could be different with --conf */ |
| 490 | fname = base_conf_file(tmpctx, ld, &must_exist); |
| 491 | ld->setconfig_file = tal_fmt(ld, "%s.setconfig", fname); |
| 492 | |
| 493 | /* We want to use a relative path here (ctime() includes \n!). */ |
| 494 | lines = tal_fmt(tmpctx, |
| 495 | "# Inserted by setconfig %sinclude %s.setconfig", |
| 496 | ctime(&now), path_basename(tmpctx, fname)); |
| 497 | append_to_file(ld, fname, lines, must_exist); |
| 498 | |
| 499 | /* This creates the file */ |
| 500 | append_to_file(ld, ld->setconfig_file, |
| 501 | "# Created and update by setconfig, but you can edit this manually when node is stopped.", |
| 502 | false); |
| 503 | } |
| 504 | |
| 505 | static void configvar_save(struct lightningd *ld, |
| 506 | const char **names, |
no test coverage detected