Skip to content

Commit

Permalink
Revert "config: UI configuration block with Vault/Consul links (#11555)"
Browse files Browse the repository at this point in the history
This reverts commit 1160817.
  • Loading branch information
tgross committed Dec 14, 2021
1 parent 73eacec commit 9a4f846
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
12 changes: 0 additions & 12 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ type Config struct {
// parameters necessary to derive tokens.
Vault *config.VaultConfig `hcl:"vault"`

// UI is used to configure the web UI
UI *config.UIConfig `hcl:"ui"`

// NomadConfig is used to override the default config.
// This is largely used for testing purposes.
NomadConfig *nomad.Config `hcl:"-" json:"-"`
Expand Down Expand Up @@ -929,7 +926,6 @@ func DefaultConfig() *Config {
AdvertiseAddrs: &AdvertiseAddrs{},
Consul: config.DefaultConsulConfig(),
Vault: config.DefaultVaultConfig(),
UI: config.DefaultUIConfig(),
Client: &ClientConfig{
Enabled: false,
MaxKillTimeout: "30s",
Expand Down Expand Up @@ -1168,14 +1164,6 @@ func (c *Config) Merge(b *Config) *Config {
result.Vault = result.Vault.Merge(b.Vault)
}

// Apply the UI Configuration
if result.UI == nil && b.UI != nil {
uiConfig := *b.UI
result.UI = &uiConfig
} else if b.UI != nil {
result.UI = result.UI.Merge(b.UI)
}

// Apply the sentinel config
if result.Sentinel == nil && b.Sentinel != nil {
server := *b.Sentinel
Expand Down
15 changes: 3 additions & 12 deletions command/agent/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ var (
// Set to false by stub_asset if the ui build tag isn't enabled
uiEnabled = true

// Displayed when ui is disabled, but overridden if the ui build
// tag isn't enabled
stubHTML = "<html><p>Nomad UI is disabled</p></html>"
// Overridden if the ui build tag isn't enabled
stubHTML = ""

// allowCORS sets permissive CORS headers for a handler
allowCORS = cors.New(cors.Options{
Expand Down Expand Up @@ -337,21 +336,13 @@ func (s *HTTPServer) registerHandlers(enableDebug bool) {
s.mux.HandleFunc("/v1/namespace", s.wrap(s.NamespaceCreateRequest))
s.mux.HandleFunc("/v1/namespace/", s.wrap(s.NamespaceSpecificRequest))

uiConfigEnabled := s.agent.config.UI != nil && s.agent.config.UI.Enabled

if uiEnabled && uiConfigEnabled {
if uiEnabled {
s.mux.Handle("/ui/", http.StripPrefix("/ui/", s.handleUI(http.FileServer(&UIAssetWrapper{FileSystem: assetFS()}))))
s.logger.Debug("UI is enabled")
} else {
// Write the stubHTML
s.mux.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(stubHTML))
})
if uiEnabled && !uiConfigEnabled {
s.logger.Warn("UI is disabled")
} else {
s.logger.Debug("UI is disabled in this build")
}
}
s.mux.Handle("/", s.handleRootFallthrough())

Expand Down
4 changes: 0 additions & 4 deletions website/data/docs-nav-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@
"title": "tls",
"path": "configuration/tls"
},
{
"title": "ui",
"path": "configuration/ui"
},
{
"title": "vault",
"path": "configuration/vault"
Expand Down

0 comments on commit 9a4f846

Please sign in to comment.