From 4e438669ad12d94e5b435a0b797972b647233485 Mon Sep 17 00:00:00 2001 From: Marcio Granzotto Date: Sun, 14 Nov 2021 19:22:45 -0300 Subject: [PATCH] Add more config options --- nightscout/DOCS.md | 15 +++++++++++++++ nightscout/config.json | 4 ++++ nightscout/rootfs/etc/services.d/nightscout/run | 16 +++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/nightscout/DOCS.md b/nightscout/DOCS.md index 0169cdd..4783c40 100644 --- a/nightscout/DOCS.md +++ b/nightscout/DOCS.md @@ -84,6 +84,17 @@ A list of plugins you would like to use. You can see the list of available plugins on [nightscout/cgm-remote-monitor][cgm-remote-monitor] The default list should be pretty much what you need. +### Option: `theme` + +Which default theme nightscout should use. +The available themes are `default`, `color` and `colorblinfriendly` +You can check more details on [Nightscout's docs][themes-docs] + +### Option: `import_config_url` + +If you want to change any other settings that are not exposed on the add-on, you can link a settings json from an URL, such as a gist. +Please check the docs on how to do that [HERE][import-config-docs] + ## Embedding into Home Assistant It is possible to embed Nightscout directly into Home Assistant, allowing you to @@ -136,3 +147,7 @@ based on the following: [cgm-remote-monitor]: https://github.com/nightscout/cgm-remote-monitor [nightscout-docs-features]: https://github.com/nightscout/cgm-remote-monitor#features + +[themes-docs]: https://nightscout.github.io/nightscout/setup_variables/#theme-colors + +[import-config-docs]: https://nightscout.github.io/nightscout/setup_variables/#import_config diff --git a/nightscout/config.json b/nightscout/config.json index 60fbbf1..7464541 100644 --- a/nightscout/config.json +++ b/nightscout/config.json @@ -24,6 +24,8 @@ "keyfile": "privkey.pem", "api_key": "", "auth_default_roles": "readable", + "theme": "colors", + "import_config_url": "", "plugins": [ "careportal", "boluscalc", @@ -50,6 +52,8 @@ "keyfile": "str", "api_key": "str", "auth_default_roles": "list(admin|denied|status-only|readable|careportal|devicestatus-upload|activity)?", + "theme": "list(default|colors|colorblindfriendly)", + "import_config_url": "str?", "plugins": ["str"] } } \ No newline at end of file diff --git a/nightscout/rootfs/etc/services.d/nightscout/run b/nightscout/rootfs/etc/services.d/nightscout/run index a62966b..a074580 100644 --- a/nightscout/rootfs/etc/services.d/nightscout/run +++ b/nightscout/rootfs/etc/services.d/nightscout/run @@ -14,7 +14,7 @@ bashio::log.info 'Starting the Nightscout server...' # Config server variables readonly api_key=$(bashio::config 'api_key') -bashio::log.info "Setting up API KEY: ${api_key}" +bashio::log.debug "Setting up API KEY: ${api_key}" export API_SECRET="${api_key}" export HOSTNAME="127.0.0.1" @@ -39,6 +39,20 @@ done bashio::log.info "Enable plugins: ${joined}" export ENABLE="${joined}" +# Theme +if bashio::config.has_value 'theme'; then + readonly theme=$(bashio::config 'theme') + bashio::log.info "Setting theme to: ${theme}" + export THEME="${theme}" +fi + +# Theme +if bashio::config.has_value 'import_config_url'; then + readonly theme=$(bashio::config 'import_config_url') + bashio::log.info "Importing config from URL: ${import_config_url}" + export IMPORT_CONFIG="${import_config_url}" +fi + # Change current working directory cd /opt/app || bashio::exit.nok 'Failed changing working directory'