Skip to content

Commit

Permalink
Merge pull request #13 from marciogranzotto/custom-config
Browse files Browse the repository at this point in the history
Add more config options
  • Loading branch information
marciogranzotto authored Nov 14, 2021
2 parents e0c7504 + 4e43866 commit 43e53c4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
15 changes: 15 additions & 0 deletions nightscout/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions nightscout/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"keyfile": "privkey.pem",
"api_key": "",
"auth_default_roles": "readable",
"theme": "colors",
"import_config_url": "",
"plugins": [
"careportal",
"boluscalc",
Expand All @@ -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"]
}
}
16 changes: 15 additions & 1 deletion nightscout/rootfs/etc/services.d/nightscout/run
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'

Expand Down

0 comments on commit 43e53c4

Please sign in to comment.