Open
Description
Hello again,
Since huntarr has migrated to a database for settings with version 8, there does not seem to be a way to set a subpath in advance of going through the setup without one.
I would recommend implementing a BASE_URL
environment variable similar to TZ
, etc. and having it imported form the ENV, if specified in the docker command or compose file
@scr4tchy would you have time to check the below suggested implementation?
In settings_manager.py
I imagine the function would look something like:
def initialize_baseurl_from_env():
"""Initialize base_url setting from BASE_URL environment variable if not already set."""
try:
# Get the BASE_URL environment variable
baseurl_env = os.environ.get('BASE_URL')
if not baseurl_env:
settings_logger.info("No BASE_URL environment variable found, using default (no subpath) ")
return
# Load current general settings
general_settings = load_settings("general")
current_baseurl = general_settings.get("base_url")
# If base_url is not set in settings, initialize it from BASE_URL environment variable
if not current_baseurl or current_baseurl == "":
settings_logger.info(f"Initializing base_url from BASE_URL environment variable: {baseurl_env}")
# Update the settings with the base_url
general_settings["base_url"] = baseurl_env
save_settings("general", general_settings)
except Exception as e:
settings_logger.error(f"Error initializing base_url from environment: {e}")
The user would then be expected to restart the container for it to take effect, but since this is happening at initialization, maybe it would not be necessary?
Metadata
Metadata
Assignees
Labels
No labels