Skip to content

Commit 48859d3

Browse files
committed
settings: default to passwd method if unset, print env for debug
1 parent 8853ef9 commit 48859d3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

README.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@ Docker-node-red
44
A docker image to deploy instances of node-red with additional nodes.
55

66
The following env vars are used to configure the container:
7+
- NO_AUTH: if set disable any authentication methods
78
- AUTH_METHOD: for now only default 'passwd' based auth is supported
89
- if `passwd` method is choice the 'admin' password is generated and display in container log
910
- AUTH_URL: the http endpoint to authenticate the user, if option is set the AUTH_METHOD is forced to 'http'
10-
- NO_AUTH: if set disable any authentication methods
1111
- SECRET: the secret used to encrypt stored credentials, if not set encryption is disabled
1212
- TITLE: if set override the default "Docker node-red" header title
1313

1414
You can also add a 'extra_modules.txt' inside '/app/config' with a list of flow extra.
1515

16-
TODO
17-
----
18-
[ ] implement flows backup/restore
19-
2016
Dokku
2117
-------------
2218

settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function () {
1616
}
1717
}
1818
}
19-
if (process.env.AUTH_METHOD != 'noauth')
19+
if (process.env.AUTH_METHOD && process.env.AUTH_METHOD !== 'noauth')
2020
obj['adminAuth']= require('./settings_' + process.env.AUTH_METHOD + '.js')
2121

2222
return obj

start.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ fi
1313

1414
# we are going to use this in user-auth. install locally
1515
npm install bcryptjs randomstring when request debug
16-
if [[ -n $AUTH_URL ]]; then
16+
if [[ -n "$NO_AUTH" ]]; then
17+
# if NO_AUTH env is set
18+
echo "*** WARNING: Disable auth ***"
19+
export AUTH_METHOD="noauth"
20+
elif [[ -n $AUTH_URL ]]; then
21+
# if AUTH_METHOD == http
1722
export AUTH_METHOD="http";
1823
echo "Using http based auth!"
19-
fi
20-
if [[ "$AUTH_METHOD" == "passwd" ]]; then
24+
else
25+
# set default auth method if nothing else defined
26+
export AUTH_METHOD="passwd"
2127
echo "Using passwd based auth!"
2228
node /app/gen_password.js
2329
fi
24-
if [[ -n "$NO_AUTH" ]]; then
25-
echo "*** WARNING: Disable auth ***"
26-
export AUTH_METHOD="noauth"
27-
fi
2830

29-
node-red -s /app/settings.js --port $PORT
31+
env
32+
echo "debug: Starting nodered... "
33+
node-red -s /app/settings.js

0 commit comments

Comments
 (0)