make password auth optional

This commit is contained in:
aptalca 2019-06-24 15:27:16 -04:00
parent afd06e9910
commit 21907310d0
3 changed files with 20 additions and 7 deletions

View File

@ -59,7 +59,7 @@ docker create \
-e PUID=1000 \ -e PUID=1000 \
-e PGID=1000 \ -e PGID=1000 \
-e TZ=Europe/London \ -e TZ=Europe/London \
-e PASSWORD=password \ -e PASSWORD=password `#optional` \
-p 8443:8443 \ -p 8443:8443 \
-v /path/to/appdata/config:/config \ -v /path/to/appdata/config:/config \
--restart unless-stopped \ --restart unless-stopped \
@ -82,7 +82,7 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- TZ=Europe/London - TZ=Europe/London
- PASSWORD=password - PASSWORD=password #optional
volumes: volumes:
- /path/to/appdata/config:/config - /path/to/appdata/config:/config
ports: ports:
@ -100,7 +100,7 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PUID=1000` | for UserID - see below for explanation | | `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London | | `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
| `-e PASSWORD=password` | Specify a web gui password | | `-e PASSWORD=password` | Optional web gui password, if not provided, there will be no auth |
| `-v /config` | Contains all relevant configuration files. | | `-v /config` | Contains all relevant configuration files. |
## User / Group Identifiers ## User / Group Identifiers

View File

@ -43,12 +43,11 @@ param_ports:
param_usage_include_env: true param_usage_include_env: true
param_env_vars: param_env_vars:
- { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"} - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"}
- { env_var: "PASSWORD", env_value: "password", desc: "Specify a web gui password"}
# optional container parameters # optional container parameters
opt_param_usage_include_env: false opt_param_usage_include_env: true
opt_param_env_vars: opt_param_env_vars:
- { env_var: "", env_value: "", desc: "" } - { env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if not provided, there will be no auth"}
optional_block_1: false optional_block_1: false
optional_block_1_items: "" optional_block_1_items: ""

View File

@ -2,5 +2,19 @@
cd /opt/code-server || exit cd /opt/code-server || exit
if [ -n "${PASSWORD}" ]; then
PASSARG="-P ${PASSWORD}"
else
PASSARG="-N"
echo "starting with no password"
fi
exec \ exec \
s6-setuidgid abc /opt/code-server/code-server -H -P ${PASSWORD} -d /config/data -e /config/extensions --disable-telemetry /config/workspace s6-setuidgid abc \
/opt/code-server/code-server \
-H \
${PASSARG} \
-d /config/data \
-e /config/extensions \
--disable-telemetry \
/config/workspace