From 2340eb4a0e29a6b106769c8ccf48c0048327533e Mon Sep 17 00:00:00 2001 From: Callum Date: Mon, 24 Jul 2023 16:31:33 +0100 Subject: [PATCH] :wrench: enable API key auth to be enabled via docker config --- docker/docker-entrypoint.d/1 | 5 ++++- docker/webapp_config.json | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/docker-entrypoint.d/1 b/docker/docker-entrypoint.d/1 index 5b7ec987..2cde66f9 100755 --- a/docker/docker-entrypoint.d/1 +++ b/docker/docker-entrypoint.d/1 @@ -15,9 +15,12 @@ if [ -f /usr/local/homer/etc/webapp_config.json ]; then if [ -n "$DB_PASS" ]; then sed -i "s/homer_password/${DB_PASS}/g" /usr/local/homer/etc/webapp_config.json; fi if [ -n "$DB_KEEPALIVE" ]; then sed -i "s/homer_db_keepalive/${DB_KEEPALIVE}/g" /usr/local/homer/etc/webapp_config.json; fi - if [ -n "$HOMER_LOGLEVEL" ]; then sed -i "s/homer_loglevel/${HOMER_LOGLEVEL}/g" /usr/local/homer/etc/webapp_config.json; + if [ -n "$HOMER_LOGLEVEL" ]; then sed -i "s/homer_loglevel/${HOMER_LOGLEVEL}/g" /usr/local/homer/etc/webapp_config.json; else sed -i "s/homer_loglevel/error/g" /usr/local/homer/etc/webapp_config.json; fi + if [ -n "$HOMER_ENABLE_API" ]; then sed -i "s/homer_enable_api/${HOMER_ENABLE_API}/g" /usr/local/homer/etc/webapp_config.json; + else sed -i "s/homer_enable_api/false/g" /usr/local/homer/etc/webapp_config.json; fi + if [ -n "$INFLUX_HOST" ]; then sed -i "s/influx_host/${INFLUX_HOST}/g" /usr/local/homer/etc/webapp_config.json; fi if [ -n "$INFLUX_USER" ]; then sed -i "s/influx_user/${INFLUX_USER}/g" /usr/local/homer/etc/webapp_config.json; fi if [ -n "$INFLUX_PASS" ]; then sed -i "s/influx_pass/${INFLUX_PASS}/g" /usr/local/homer/etc/webapp_config.json; fi diff --git a/docker/webapp_config.json b/docker/webapp_config.json index 986ab175..2429ec8e 100644 --- a/docker/webapp_config.json +++ b/docker/webapp_config.json @@ -40,6 +40,9 @@ "host": "http://loki_host:3100", "api": "api/prom" }, + "api_settings": { + "enable_token_auth": homer_enable_api + }, "http_settings": { "host": "0.0.0.0", "port": homer_web_port,