Skip to content

Commit 9212134

Browse files
Merge pull request #215 from dannya/dotenv-support
.env support
2 parents 097a747 + cfb6a15 commit 9212134

File tree

5 files changed

+371
-50
lines changed

5 files changed

+371
-50
lines changed

.env.example

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copy this file to `.env` and adjust the values accordingly.
2+
# All commented-out options below are optional config settings - uncomment the line to explicitly set and use a value.
3+
4+
###################
5+
# LibreLink config
6+
###################
7+
8+
# LibreLink Up Login Email
9+
LINK_UP_USERNAME="mail@example.com"
10+
11+
# LibreLink Up Login Password
12+
LINK_UP_PASSWORD="mypassword"
13+
14+
# LibreLink Up Patient-ID. Can be received from the console output if multiple connections are available.
15+
#LINK_UP_CONNECTION="123456abc-abcd-efgh-7891def"
16+
17+
# The time interval (in minutes) of requesting values from libre link up.
18+
#LINK_UP_TIME_INTERVAL=5
19+
20+
# Your region. Used to determine the correct LibreLinkUp service.
21+
# Possible values: AE, AP, AU, CA, DE, EU, EU2, FR, JP, US, LA, RU, CN
22+
#LINK_UP_REGION="EU"
23+
24+
# LibreLink Up App Version.
25+
# This may need to be updated if you are using a newer version of the LibreLink Up App.
26+
#LINK_UP_VERSION=4.16.0
27+
28+
###################
29+
# Nightscout config
30+
###################
31+
32+
# Hostname of the Nightscout instance (without https://)
33+
NIGHTSCOUT_URL="nightscout.yourdomain.com"
34+
35+
# SHA1 Hash of Nightscout access token
36+
# Command to convert: `echo -n "librelinku-123456789abcde" | sha1sum | cut -d ' ' -f 1` (use `shasum` instead of `sha1sum` on Mac)
37+
NIGHTSCOUT_API_TOKEN="162f14de46149447c3338a8286223de407e3b2fa"
38+
39+
# Disables the HTTPS requirement for Nightscout URLs
40+
#NIGHTSCOUT_DISABLE_HTTPS=true
41+
42+
# Sets the device name used in Nightscout
43+
#NIGHTSCOUT_DEVICE_NAME="nightscout-librelink-up"
44+
45+
###################
46+
# Script config
47+
###################
48+
49+
# The setting of verbosity for logging, should be one of info or debug
50+
#LOG_LEVEL="info"
51+
52+
# Disables the scheduler and runs the script just once
53+
#SINGLE_SHOT=true
54+
55+
# Upload all available data from LibreLink Up instead of just data newer than last upload.
56+
# LibreLinkUp sometimes lags behind in reporting recent historical data, so it is advised to run the script with ALL_DATA set to true at least once a day.
57+
#ALL_DATA=true

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ work with at least Freestyle Libre 2 (FGM) and Libre 3 CGM sensors.
1717

1818
## Configuration
1919

20-
The script takes the following environment variables
20+
The script takes the following environment variables:
2121

2222
| Variable | Description | Example | Required |
2323
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|----------|
2424
| LINK_UP_USERNAME | LibreLink Up Login Email | mail@example.com | X |
2525
| LINK_UP_PASSWORD | LibreLink Up Login Password | mypassword | X |
2626
| LINK_UP_CONNECTION | LibreLink Up Patient-ID. Can be received from the console output if multiple connections are available. | 123456abc-abcd-efgh-7891def | |
27-
| LINK_UP_TIME_INTERVAL | The time interval of requesting values from libre link up | 5 | |
27+
| LINK_UP_TIME_INTERVAL | The time interval (in minutes) of requesting values from libre link up. | 5 | |
2828
| LINK_UP_REGION | Your region. Used to determine the correct LibreLinkUp service (Possible values: AE, AP, AU, CA, DE, EU, EU2, FR, JP, US, LA, RU, CN) | EU | |
29-
| LINK_UP_VERSION | LibreLink Up App Version. This may need to be updated if you are using a newer version of the LibreLink Up App | 4.16.0 | |
29+
| LINK_UP_VERSION | LibreLink Up App Version. This may need to be updated if you are using a newer version of the LibreLink Up App. | 4.16.0 | |
3030
| NIGHTSCOUT_URL | Hostname of the Nightscout instance (without https://) | nightscout.yourdomain.com | X |
3131
| NIGHTSCOUT_API_TOKEN | SHA1 Hash of Nightscout access token | 162f14de46149447c3338a8286223de407e3b2fa | X |
3232
| NIGHTSCOUT_DISABLE_HTTPS | Disables the HTTPS requirement for Nightscout URLs | true | |
@@ -35,6 +35,8 @@ The script takes the following environment variables
3535
| SINGLE_SHOT | Disables the scheduler and runs the script just once | true | |
3636
| ALL_DATA | Upload all available data from LibreLink Up instead of just data newer than last upload. LibreLinkUp sometimes lags behind in reporting recent historical data, so it is advised to run the script with ALL_DATA set to true at least once a day. | true | |
3737

38+
These variables can be set in your environment or in a `.env` file in the root directory of the project - see `.env.example` for an example (copy this file to `.env` and adjust the values accordingly).
39+
3840
## Usage
3941

4042
There are different options for using this script.
@@ -66,7 +68,13 @@ There are different options for using this script.
6668

6769
The installation process can be started by running `npm install` in the root directory.
6870

69-
To start the process simply create a bash script with the set environment variables (`start.sh`):
71+
To start the script, either:
72+
73+
1. Copy `.env.example` file to `.env` and adjust the values accordingly, then run `npm start`
74+
75+
or
76+
77+
2. Create a bash script with the set environment variables (`start.sh`), then execute the script and check the console output:
7078

7179
```shell
7280
#!/bin/bash
@@ -81,8 +89,6 @@ export LOG_LEVEL="info"
8189
npm start
8290
```
8391

84-
Execute the script and check the console output.
85-
8692
### Variant 5: Docker
8793

8894
The easiest way to use this is to use the latest docker image:

0 commit comments

Comments
 (0)