Closed petwall closed 6 months ago
The script that reads in my.env is a Node script, which should run identically across platforms, are you sure you're not confusing between the command line Ubuntu behaviour and the env file? Regardless, if you want to set variables with a space in the value, I'd recommend using quotes, so try CUSTOM_TITLE="MySons Name"
as a line in the file.
Yes, got it. As you say, the problem here is the way Nightscout is started on Ubuntu (with the command line as below), which does not allow CUSTOM_TITLE="Name Name"
as a format.
pw@jidder:~/nightscout$ env $(cat my.env) PORT=1337 pm2 start server.js
env: ‘Name"’: No such file or directory
@sulkaharo do you mean on other platforms that nightscout is not relying on environmental variables, but actually parse the my.env variables when the server is started? (it seems from the other guides for Heroku and others, that the config is about setting up the environment variables on the hosting system?)
Anyway, on Ubuntu, I stumbled into some severe problems with the way env
is being used to read the config -- in the end I had to place some complex variables as LOOP_APNS_KEY
in my .profile
instead, since URL-encoding it the right way was tricky...
Ok, from what I can see, the my.env file is never parsed, but the config is being read from the environment.
I solved it in the following way for Ubuntu, I installed dotenv-cli
npm install -g dotenv-cli
and then started the server with the following command instead:
dotenv -e my.env -- pm2 start server.js
Then it's fully possible to use quotation + spaces in the my.env file... this is most likely a better approach.
Anyhow, I see that this has nothing to do with the nightscout code itself to do, but how the environment is set up on Ubuntu. Since there are several ways to resolve this with the way nightscout is invoked, this issue can be resolved as invalid.
Closing
If you need support for Nightscout, PLEASE DO NOT FILE A TICKET HERE For support, please post a question to the "CGM in The Cloud" group in Facebook (https://www.facebook.com/groups/cgminthecloud) or visit the WeAreNotWaiting Discord at https://discord.gg/zg7CvCQ
Describe the bug I run Nightscout on Ubuntu, which requires all variables specified in my.env to be URLencoded.
I set CUSTOM_TITLE=MySons%20Name It's being rendered as 'MySons%20Name' instead of 'MySons Name'
To Reproduce Steps to reproduce the behavior:
Expected behavior Rendered with a space: 'The Name' instead of 'The%20Name'
Screenshots If applicable, add screenshots to help explain your problem.
Your setup information
What version of Nightscout (e.g. 0.10.3) nightscout, version 15.0.1, head
What type of CGM, and how do you get your data there? (e.g. G4 and ShareBridge, or wired receiver, etc.) Dexcom G6, not using Bridge, I write data to Nightscout from Loop
Is your issue specific to a browser (Firefox/Safari/Chrome?) or a device (Android phone, etc.)?
Additional context I guess an easy/safe fix for this would be to do something like this (didn't know exactly how to contribute with code properly, will look into that :-) )
% git diff index.js diff --git a/lib/client/index.js b/lib/client/index.js index 0f0d17b7..fb5d8066 100644 --- a/lib/client/index.js +++ b/lib/client/index.js @@ -392,6 +392,7 @@ client.load = function load (serverSettings, callback) {
function resetCustomTitle () { var customTitle = client.settings.customTitle || 'Nightscout';
Screenshot before/after the fix on my nightscout instance