()
| 70 | ) |
| 71 | |
| 72 | func main() { |
| 73 | // Pre-parse --env-file before serpent runs so that variables from |
| 74 | // the file are visible to serpent's Env-tag resolution for other |
| 75 | // options. The flag is also registered in the serpent OptionSet |
| 76 | // below for --help discoverability. |
| 77 | envFile, err := parseEnvFileFlag() |
| 78 | if err != nil { |
| 79 | _, _ = fmt.Fprintf(os.Stderr, "develop: %v\n", err) |
| 80 | os.Exit(1) |
| 81 | } |
| 82 | if envFile != "" { |
| 83 | n, err := loadEnvFile(envFile) |
| 84 | if err != nil { |
| 85 | _, _ = fmt.Fprintf(os.Stderr, "develop: error loading env file %s: %v\n", envFile, err) |
| 86 | os.Exit(1) |
| 87 | } |
| 88 | _, _ = fmt.Fprintf(os.Stderr, "develop: loaded %d variable(s) from %s\n", n, envFile) |
| 89 | } |
| 90 | |
| 91 | var cfg devConfig |
| 92 | |
| 93 | cmd := &serpent.Command{ |
| 94 | Use: "develop", |
| 95 | Short: "Orchestrate the Coder development environment.", |
| 96 | Options: serpent.OptionSet{ |
| 97 | { |
| 98 | Flag: "port", |
| 99 | Env: "CODER_DEV_PORT", |
| 100 | Default: defaultAPIPort, |
| 101 | Description: "API server port.", |
| 102 | Value: serpent.Int64Of(&cfg.apiPort), |
| 103 | }, |
| 104 | { |
| 105 | Flag: "web-port", |
| 106 | Env: "CODER_DEV_WEB_PORT", |
| 107 | Default: defaultWebPort, |
| 108 | Description: "Frontend dev server port.", |
| 109 | Value: serpent.Int64Of(&cfg.webPort), |
| 110 | }, |
| 111 | { |
| 112 | Flag: "proxy-port", |
| 113 | Env: "CODER_DEV_PROXY_PORT", |
| 114 | Default: defaultProxyPort, |
| 115 | Description: "Workspace proxy port.", |
| 116 | Value: serpent.Int64Of(&cfg.proxyPort), |
| 117 | }, |
| 118 | { |
| 119 | Flag: "prometheus-port", |
| 120 | Env: "CODER_DEV_PROMETHEUS_PORT", |
| 121 | Default: defaultPrometheusPort, |
| 122 | Description: "Prometheus metrics port. Set to 0 to disable.", |
| 123 | Value: serpent.Int64Of(&cfg.coderMetricsPort), |
| 124 | }, |
| 125 | { |
| 126 | Flag: "port-offset", |
| 127 | Env: "CODER_DEV_PORT_OFFSET", |
| 128 | Default: "false", |
| 129 | Description: "Apply a deterministic per-worktree offset to default API, web, proxy, and Coder metrics ports. Useful when running multiple worktrees in parallel.", |
nothing calls this directly
no test coverage detected