Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional environment variables configuration option and force timezone to use UTC #68

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ The configuration is self-explanatory, but essentially we need details about acc

- `silent`: (Optional) Hide all output except errors in the log file. Default: `false`.

- `env_vars`: (Optional) Set additional environment variables for Ghostfolio which aren't currently exposed by the configuration options in this add-on.

Each entry is made up of a name and value:

- `name`: The case-sensitive environment variable name.
- `value`: The value to be set in the environment variable.

Note: These will also overwrite any environment variable set using the configuration options above.

Remember to restart the add-on when the configuration is changed.

To use this add-on with a reverse proxy, like [Nginx Proxy Manager][rev-proxy], you will need to enable "Show disabled ports" in the Network section of the add-on configuration and set a port.
Expand Down
9 changes: 7 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"database_pass": null,
"database_port": 5432,
"database_host": null,
"database_name": "ghostfolio"
"database_name": "ghostfolio",
"env_vars": []
},
"schema": {
"database_user": "str",
Expand All @@ -35,7 +36,11 @@
"api_key_coingecko_pro": "str?",
"access_token_salt": "str?",
"jwt_secret_key": "str?",
"silent": "bool?"
"silent": "bool?",
"env_vars": [{
"name": "str?",
"value": "str?"
}]
},
"codenotary": "[email protected]",
"image": "ghcr.io/lildude/ha-addon-ghostfolio-{arch}"
Expand Down
11 changes: 10 additions & 1 deletion rootfs/etc/services.d/ghostfolio/run
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ REDIS_HOST=localhost
REDIS_PORT=6379
NODE_ENV=production
DATABASE_URL="postgresql://$POSTGRES_USER:$POSTGRES_PASS@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB?connect_timeout=300&sslmode=prefer"
TZ=UTC # Force timezone to prevent https://github.com/ghostfolio/ghostfolio/issues/2669 which is probably due to https://github.com/brianc/node-postgres/issues/2141

export ACCESS_TOKEN_SALT JWT_SECRET_KEY POSTGRES_HOST POSTGRES_DB POSTGRES_PASS POSTGRES_PORT POSTGRES_USER \
API_KEY_COINGECKO_DEMO API_KEY_COINGECKO_PRO REDIS_HOST REDIS_PORT NODE_ENV DATABASE_URL
API_KEY_COINGECKO_DEMO API_KEY_COINGECKO_PRO REDIS_HOST REDIS_PORT NODE_ENV DATABASE_URL TZ

# These are optional and applied last so we can override those set above if needed.
for env_var in $(bashio::config 'env_vars|keys'); do
name=$(bashio::config "env_vars[${env_var}].name")
value=$(bashio::config "env_vars[${env_var}].value")
bashio::log.debug "Setting Env Variable ${name} to ${value}"
export "${name}=${value}"
done

bashio::log.info "Starting Ghostfolio"
cd /ghostfolio/apps/api
Expand Down
3 changes: 3 additions & 0 deletions translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ configuration:
silent:
name: Silent mode
description: Hide all output except errors in the log file.
env_vars:
name: Environment Variables
description: Set additional environment variables for Ghostfolio which aren't currently exposed by the configuration options in this add-on.