Skip to content

Commit 585ff92

Browse files
authored
Merge pull request #155 from arnaud-morvan/show-config
Add show show-config option
2 parents 6e016c4 + a4e1adc commit 585ff92

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dbsync_daemon.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
import pathlib
1111
import platform
12+
import pprint
1213
import sys
1314
import time
1415

@@ -96,6 +97,11 @@ def main():
9697
action="store_true",
9798
help="Send test notification email using the `notification` settings. Should be used to validate settings.",
9899
)
100+
parser.add_argument(
101+
"--show-config",
102+
action="store_true",
103+
help="Show runtime config, useful when using env vars in config file.",
104+
)
99105

100106
args = parser.parse_args()
101107

@@ -105,13 +111,17 @@ def main():
105111
else:
106112
setup_logger()
107113

108-
logging.debug(f"== starting mergin-db-sync daemon == version {__version__} ==")
109-
110114
try:
111115
update_config_path(args.config_file)
112116
except IOError as e:
113117
handle_error_and_exit(e)
114118

119+
if args.show_config:
120+
pprint.pprint(config.as_dict())
121+
sys.exit(0)
122+
123+
logging.debug(f"== starting mergin-db-sync daemon == version {__version__} ==")
124+
115125
sleep_time = config.as_int("daemon.sleep_time")
116126
try:
117127
validate_config(config)

0 commit comments

Comments
 (0)