Skip to content

Commit

Permalink
Merge pull request #575 from carterbourette/disable-web-ui
Browse files Browse the repository at this point in the history
feat: Add environment configuration to disable Web UI
  • Loading branch information
adamdecaf authored Nov 15, 2024
2 parents 5273af3 + 10a5b81 commit 6471d37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ PONG
| `HTTP_ADMIN_BIND_ADDRESS` | Address to bind admin HTTP server on. This overrides the command-line flag `-admin.addr`. | Default: `:9094` |
| `HTTPS_CERT_FILE` | Filepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP. | Empty |
| `HTTPS_KEY_FILE` | Filepath of a private key matching the leaf certificate from `HTTPS_CERT_FILE`. | Empty |
| `DISABLE_WEB_UI` | Skip serving and setup of the web UI. | Default: `false` |
| `WEB_ROOT` | Directory to serve web UI from. | Default: `webui/` |
| `WEBHOOK_MAX_WORKERS` | Maximum number of workers processing webhooks. | Default: 10 |
| `DOWNLOAD_WEBHOOK_URL` | Optional webhook URL called when data downloads / refreshes occur. | Empty |
Expand Down
10 changes: 10 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ func getDataRefreshInterval(logger log.Logger, env string) time.Duration {
}

func setupWebui(logger log.Logger, r *mux.Router, basePath string) {
var disableWebUI bool
if val, err := strconv.ParseBool(os.Getenv("DISABLE_WEB_UI")); err == nil {
disableWebUI = val
}

if disableWebUI {
logger.Log("Disabling webui")
return
}

dir := os.Getenv("WEB_ROOT")
if dir == "" {
dir = filepath.Join("webui", "build")
Expand Down

0 comments on commit 6471d37

Please sign in to comment.