From 398cde6f221dece7462eacb93b21329c497949ef Mon Sep 17 00:00:00 2001 From: gmega Date: Tue, 29 Oct 2024 19:30:00 -0300 Subject: [PATCH] allow an initial user to be created from env vars --- docker/bin/create_config.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/bin/create_config.py b/docker/bin/create_config.py index 112aac340..329183746 100644 --- a/docker/bin/create_config.py +++ b/docker/bin/create_config.py @@ -8,6 +8,7 @@ from dataclasses import dataclass from typing import Optional, Dict from deluge.configmanager import ConfigManager, set_config_dir +from deluge.core.authmanager import AuthManager from deluge.core.preferencesmanager import DEFAULT_PREFS @@ -108,10 +109,20 @@ def main(): defaults['torrentfiles_location'] = options['DELUGE_TORRENTFILE_DIR'] defaults['plugins_location'] = options['DELUGE_PLUGINS_DIR'] - + # Create default config. manager = ConfigManager('core.conf', defaults=defaults) manager.save() + # Create user. + auth_manager = AuthManager() + auth_manager.start() + auth_manager.create_account( + username=options['DELUGE_DAEMON_USERNAME'], + password=options['DELUGE_DAEMON_PASSWORD'], + authlevel='ADMIN', + ) + auth_manager.update() + if __name__ == '__main__': main()