From f43f4d4ee4c28db3cbd0c1d7274aa8459d41adbf Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Tue, 2 Jan 2024 14:08:31 -0800 Subject: [PATCH] chore: cleans up docs for env vars --- docs/guide/supported-env-vars.md | 30 +++++++++++++++--------------- main.go | 22 ++++++---------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/docs/guide/supported-env-vars.md b/docs/guide/supported-env-vars.md index 35fab0e9..dbbc5e1c 100644 --- a/docs/guide/supported-env-vars.md +++ b/docs/guide/supported-env-vars.md @@ -6,18 +6,18 @@ title: Environment variables and configuration Configurations can be done with flags or environment variables. The table below outlines all supported options and their respective env vars. -| Flag | Env Variable | Default | -| ------------------ | ----------------------- | ------- | -| `--addr` | `DOZZLE_ADDR` | `:8080` | -| `--auth-provider` | `DOZZLE_AUTH_PROVIDER` | false | -| `--base` | `DOZZLE_BASE` | `/` | -| `--enable-actions` | `DOZZLE_ENABLE_ACTIONS` | false | -| `--filter` | `DOZZLE_FILTER` | `""` | -| `--hostname` | `DOZZLE_HOSTNAME` | `""` | -| `--level` | `DOZZLE_LEVEL` | `info` | -| `--no-analytics` | `DOZZLE_NO_ANALYTICS` | false | -| `--password` | `DOZZLE_PASSWORD` | `""` | -| `--passwordfile` | `DOZZLE_PASSWORD_FILE` | `""` | -| `--remote-host` | `DOZZLE_REMOTE_HOST` | `""` | -| `--username` | `DOZZLE_USERNAME` | `""` | -| `--usernamefile` | `DOZZLE_USERNAME_FILE` | `""` | +| Flag | Env Variable | Default | +| --------------------------- | -------------------------------- | -------------- | +| `--addr` | `DOZZLE_ADDR` | `:8080` | +| `--base` | `DOZZLE_BASE` | `/` | +| `--hostname` | `DOZZLE_HOSTNAME` | `""` | +| `--level` | `DOZZLE_LEVEL` | `info` | +| `--auth-provider` | `DOZZLE_AUTH_PROVIDER` | false | +| `--auth-header-user` | `DOZZLE_AUTH_HEADER_USER` | `Remote-User` | +| `--auth-header-email` | `DOZZLE_AUTH_HEADER_EMAIL` | `Remote-Email` | +| `--auth-header-name` | `DOZZLE_AUTH_HEADER_NAME` | `Remote-Name` | +| `--enable-actions` | `DOZZLE_ENABLE_ACTIONS` | false | +| `--wait-for-docker-seconds` | `DOZZLE_WAIT_FOR_DOCKER_SECONDS` | 0 | +| `--filter` | `DOZZLE_FILTER` | `""` | +| `--no-analytics` | `DOZZLE_NO_ANALYTICS` | false | +| `--remote-host` | `DOZZLE_REMOTE_HOST` | | diff --git a/main.go b/main.go index 9654a5a2..715c0cd4 100644 --- a/main.go +++ b/main.go @@ -27,16 +27,6 @@ var ( version = "head" ) -type DockerSecret struct { - Value string -} - -func (s *DockerSecret) UnmarshalText(b []byte) error { - v, err := os.ReadFile(string(b)) - s.Value = strings.Trim(string(v), "\r\n") - return err -} - type args struct { Addr string `arg:"env:DOZZLE_ADDR" default:":8080" help:"sets host:port to bind for server. This is rarely needed inside a docker container."` Base string `arg:"env:DOZZLE_BASE" default:"/" help:"sets the base for http router."` @@ -44,17 +34,17 @@ type args struct { Level string `arg:"env:DOZZLE_LEVEL" default:"info" help:"set Dozzle log level. Use debug for more logging."` Username string `arg:"env:DOZZLE_USERNAME" help:"sets the username for auth."` Password string `arg:"env:DOZZLE_PASSWORD" help:"sets password for auth"` - AuthHeaderUser string `arg:"env:DOZZLE_AUTH_HEADER_USER" default:"Remote-User" help:"sets the HTTP Header to use for username in Forward Proxy configuration."` - AuthHeaderEmail string `arg:"env:DOZZLE_AUTH_HEADER_EMAIL" default:"Remote-Email" help:"sets the HTTP Header to use for email in Forward Proxy configuration."` - AuthHeaderName string `arg:"env:DOZZLE_AUTH_HEADER_NAME" default:"Remote-Name" help:"sets the HTTP Header to use for name in Forward Proxy configuration."` - NoAnalytics bool `arg:"--no-analytics,env:DOZZLE_NO_ANALYTICS" help:"disables anonymous analytics"` + AuthProvider string `arg:"--auth-provider,env:DOZZLE_AUTH_PROVIDER" default:"none" help:"sets the auth provider to use. Currently only forward-proxy is supported."` + AuthHeaderUser string `arg:"--auth-header-user,env:DOZZLE_AUTH_HEADER_USER" default:"Remote-User" help:"sets the HTTP Header to use for username in Forward Proxy configuration."` + AuthHeaderEmail string `arg:"--auth-header-email,env:DOZZLE_AUTH_HEADER_EMAIL" default:"Remote-Email" help:"sets the HTTP Header to use for email in Forward Proxy configuration."` + AuthHeaderName string `arg:"--auth-header-name,env:DOZZLE_AUTH_HEADER_NAME" default:"Remote-Name" help:"sets the HTTP Header to use for name in Forward Proxy configuration."` WaitForDockerSeconds int `arg:"--wait-for-docker-seconds,env:DOZZLE_WAIT_FOR_DOCKER_SECONDS" help:"wait for docker to be available for at most this many seconds before starting the server."` + EnableActions bool `arg:"--enable-actions,env:DOZZLE_ENABLE_ACTIONS" default:"false" help:"enables essential actions on containers from the web interface."` FilterStrings []string `arg:"env:DOZZLE_FILTER,--filter,separate" help:"filters docker containers using Docker syntax."` Filter map[string][]string `arg:"-"` Healthcheck *HealthcheckCmd `arg:"subcommand:healthcheck" help:"checks if the server is running."` RemoteHost []string `arg:"env:DOZZLE_REMOTE_HOST,--remote-host,separate" help:"list of hosts to connect remotely"` - AuthProvider string `arg:"--auth-provider,env:DOZZLE_AUTH_PROVIDER" default:"none" help:"sets the auth provider to use. Currently only forward-proxy is supported."` - EnableActions bool `arg:"--enable-actions,env:DOZZLE_ENABLE_ACTIONS" default:"false" help:"enables essential actions on containers from the web interface."` + NoAnalytics bool `arg:"--no-analytics,env:DOZZLE_NO_ANALYTICS" help:"disables anonymous analytics"` } type HealthcheckCmd struct {