From 21907310d04ecaca50f1caabcab33946b26d53bb Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 24 Jun 2019 15:27:16 -0400 Subject: [PATCH] make password auth optional --- README.md | 6 +++--- readme-vars.yml | 5 ++--- root/etc/services.d/code-server/run | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index aad2415..34998c2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ docker create \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Europe/London \ - -e PASSWORD=password \ + -e PASSWORD=password `#optional` \ -p 8443:8443 \ -v /path/to/appdata/config:/config \ --restart unless-stopped \ @@ -82,7 +82,7 @@ services: - PUID=1000 - PGID=1000 - TZ=Europe/London - - PASSWORD=password + - PASSWORD=password #optional volumes: - /path/to/appdata/config:/config 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 PGID=1000` | for GroupID - see below for explanation | | `-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. | ## User / Group Identifiers diff --git a/readme-vars.yml b/readme-vars.yml index 44d823b..7dc9445 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -43,12 +43,11 @@ param_ports: param_usage_include_env: true param_env_vars: - { 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 -opt_param_usage_include_env: false +opt_param_usage_include_env: true 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_items: "" diff --git a/root/etc/services.d/code-server/run b/root/etc/services.d/code-server/run index 86ae4a6..4a45b11 100644 --- a/root/etc/services.d/code-server/run +++ b/root/etc/services.d/code-server/run @@ -2,5 +2,19 @@ cd /opt/code-server || exit +if [ -n "${PASSWORD}" ]; then + PASSARG="-P ${PASSWORD}" +else + PASSARG="-N" + echo "starting with no password" +fi + 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