| 125 | } |
| 126 | |
| 127 | func parseRawConfig() *rawConfig { |
| 128 | c := &rawConfig{ |
| 129 | OriginURL: flag.String("origin-url", "", "Origin to proxy. e.g.: http://localhost:2002"), |
| 130 | ProxyURL: flag.String("proxy-url", "", "Outer URL of this host. e.g.: http://secrets.example.com"), |
| 131 | ListenURL: flag.String("listen-url", "", "Address on which to listen. Leave blank to derive a value from proxy-url. e.g.: localhost:2001"), |
| 132 | SSOURL: flag.String("sso-url", "", "SSO endpoint. e.g.: http://discourse.forum.com"), |
| 133 | SSOSecret: flag.String("sso-secret", "", "SSO secret for origin"), |
| 134 | AllowAll: flag.Bool("allow-all", false, "Allow all discourse users (default: admin users only)"), |
| 135 | AllowGroups: flag.String("allow-groups", "", "Allow users belonging to the specified groups, comma delimited (default: no groups are allowed)"), |
| 136 | BasicAuth: flag.String("basic-auth", "", "HTTP Basic authentication credentials to let through directly"), |
| 137 | Whitelist: flag.String("whitelist", "", "Path which does not require authorization"), |
| 138 | WhitelistPrefix: flag.String("whitelist-prefix", "", "Prefix for paths which do not require authorization"), |
| 139 | UsernameHeader: flag.String("username-header", "Discourse-User-Name", "Request header to pass authenticated username into"), |
| 140 | GroupsHeader: flag.String("groups-header", "Discourse-User-Groups", "Request header to pass authenticated groups into"), |
| 141 | Timeout: flag.Int("timeout", 10, "Read/write timeout (seconds)"), |
| 142 | SRVAbandonAfter: flag.Int("dns-srv-abandon-after", 600, "Abandon DNS SRV discovery if origin RRs do not appear within this time (seconds). When negative, attempt SRV lookups indefinitely."), |
| 143 | LogRequests: flag.Bool("log-requests", false, "Log all requests to standard error"), |
| 144 | } |
| 145 | flag.Parse() |
| 146 | return c |
| 147 | } |
| 148 | |
| 149 | func usage(err error) { |
| 150 | flag.Usage() |