()
| 47 | } |
| 48 | |
| 49 | func (r *RootCmd) proxyServer() *serpent.Command { |
| 50 | var ( |
| 51 | cfg = new(codersdk.DeploymentValues) |
| 52 | // Filter options for only relevant ones. |
| 53 | opts = cfg.Options().Filter(codersdk.IsWorkspaceProxies) |
| 54 | |
| 55 | externalProxyOptionGroup = serpent.Group{ |
| 56 | Name: "External Workspace Proxy", |
| 57 | YAML: "externalWorkspaceProxy", |
| 58 | } |
| 59 | proxySessionToken serpent.String |
| 60 | primaryAccessURL serpent.URL |
| 61 | derpOnly serpent.Bool |
| 62 | ) |
| 63 | opts.Add( |
| 64 | // Options only for external workspace proxies |
| 65 | |
| 66 | serpent.Option{ |
| 67 | Name: "Proxy Session Token", |
| 68 | Description: "Authentication token for the workspace proxy to communicate with coderd.", |
| 69 | Flag: "proxy-session-token", |
| 70 | Env: "CODER_PROXY_SESSION_TOKEN", |
| 71 | YAML: "proxySessionToken", |
| 72 | Required: true, |
| 73 | Value: &proxySessionToken, |
| 74 | Group: &externalProxyOptionGroup, |
| 75 | Hidden: false, |
| 76 | }, |
| 77 | |
| 78 | serpent.Option{ |
| 79 | Name: "Coderd (Primary) Access URL", |
| 80 | Description: "URL to communicate with coderd. This should match the access URL of the Coder deployment.", |
| 81 | Flag: "primary-access-url", |
| 82 | Env: "CODER_PRIMARY_ACCESS_URL", |
| 83 | YAML: "primaryAccessURL", |
| 84 | Required: true, |
| 85 | Value: serpent.Validate(&primaryAccessURL, func(value *serpent.URL) error { |
| 86 | if !(value.Scheme == "http" || value.Scheme == "https") { |
| 87 | return xerrors.Errorf("'--primary-access-url' value must be http or https: url=%s", primaryAccessURL.String()) |
| 88 | } |
| 89 | return nil |
| 90 | }), |
| 91 | Group: &externalProxyOptionGroup, |
| 92 | Hidden: false, |
| 93 | }, |
| 94 | serpent.Option{ |
| 95 | Name: "DERP-only proxy", |
| 96 | Description: "Run a proxy server that only supports DERP connections and does not proxy workspace app/terminal traffic.", |
| 97 | Flag: "derp-only", |
| 98 | Env: "CODER_PROXY_DERP_ONLY", |
| 99 | YAML: "derpOnly", |
| 100 | Required: false, |
| 101 | Value: &derpOnly, |
| 102 | Group: &externalProxyOptionGroup, |
| 103 | Hidden: false, |
| 104 | }, |
| 105 | ) |
| 106 |
no test coverage detected