From c8b8468030891374885da72e29a956bf601e1625 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Sun, 29 Jan 2023 18:21:53 -0500 Subject: [PATCH] Move resets before controller is instanciated. --- main.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 4aa5880c..5f05390e 100644 --- a/main.py +++ b/main.py @@ -140,6 +140,14 @@ if __name__ == "__main__": installer.default_settings() else: Console.debug("Existing install detected") + Console.info("Checking for reset secret flag") + if helper.get_setting("reset_secrets_on_next_boot"): + Console.info("Found Reset") + management_helper.set_secret_api_key(str(helper.random_string_generator(64))) + management_helper.set_cookie_secret(str(helper.random_string_generator(32))) + helper.set_setting("reset_secrets_on_next_boot", False) + else: + Console.info("No flag found. Secrets are staying") file_helper = FileHelpers(helper) import_helper = ImportHelpers(helper, file_helper) # now the tables are created, we can load the tasks_manager and server controller @@ -148,17 +156,6 @@ if __name__ == "__main__": controller.get_config_diff() Console.info("Remote change complete.") - Console.info("Checking for reset secret flag") - if helper.get_setting("reset_secrets_on_next_boot"): - Console.info("Found Reset") - controller.management.set_crafty_api_key( - str(helper.random_string_generator(64)) - ) - controller.management.set_cookie_secret(str(helper.random_string_generator(32))) - helper.set_setting("reset_secrets_on_next_boot", False) - else: - Console.info("No flag found. Secrets are staying") - import3 = Import3(helper, controller) tasks_manager = TasksManager(helper, controller) tasks_manager.start_webserver()