Skip to content

Commit

Permalink
Add optional environment variables configuration option and force tim…
Browse files Browse the repository at this point in the history
…ezone to use UTC (#68)

* Add optional env vars config

* Force timezone to UTC

* Reword
  • Loading branch information
lildude authored Jul 29, 2024
1 parent e21d451 commit f63d40d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
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": "colin@symr.io",
"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.

0 comments on commit f63d40d

Please sign in to comment.