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 more config options #13

Merged
merged 1 commit into from
Nov 14, 2021
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
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