feat: add `ui-disabled` flag to run server with UI disabled (#21910)
* feat: add `ui-disabled` flag to run server with UI disabled * chore: update CHANGELOGpull/21909/head
parent
a78729b2ff
commit
e7685fff01
|
@ -35,6 +35,7 @@ This release adds an embedded SQLite database for storing metadata required by t
|
||||||
1. [21888](https://github.com/influxdata/influxdb/pull/21888/): Ported the `influxd inspect dump-wal` command from 1.x.
|
1. [21888](https://github.com/influxdata/influxdb/pull/21888/): Ported the `influxd inspect dump-wal` command from 1.x.
|
||||||
1. [21828](https://github.com/influxdata/influxdb/pull/21828): Added the command `influx inspect verify-wal`.
|
1. [21828](https://github.com/influxdata/influxdb/pull/21828): Added the command `influx inspect verify-wal`.
|
||||||
1. [21814](https://github.com/influxdata/influxdb/pull/21814): Ported the `influxd inspect report-tsm` command from 1.x.
|
1. [21814](https://github.com/influxdata/influxdb/pull/21814): Ported the `influxd inspect report-tsm` command from 1.x.
|
||||||
|
1. [21910](https://github.com/influxdata/influxdb/pull/21910): Added `--ui-disabled` option to `influxd` to allow for running with the UI disabled.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ type InfluxdOpts struct {
|
||||||
|
|
||||||
ProfilingDisabled bool
|
ProfilingDisabled bool
|
||||||
MetricsDisabled bool
|
MetricsDisabled bool
|
||||||
|
UIDisabled bool
|
||||||
|
|
||||||
NatsPort int
|
NatsPort int
|
||||||
NatsMaxPayloadBytes int
|
NatsMaxPayloadBytes int
|
||||||
|
@ -199,6 +200,7 @@ func NewOpts(viper *viper.Viper) *InfluxdOpts {
|
||||||
|
|
||||||
ProfilingDisabled: false,
|
ProfilingDisabled: false,
|
||||||
MetricsDisabled: false,
|
MetricsDisabled: false,
|
||||||
|
UIDisabled: false,
|
||||||
|
|
||||||
StoreType: DiskStore,
|
StoreType: DiskStore,
|
||||||
SecretStore: BoltStore,
|
SecretStore: BoltStore,
|
||||||
|
@ -580,5 +582,12 @@ func (o *InfluxdOpts) BindCliOpts() []cli.Opt {
|
||||||
Desc: "Don't expose metrics over HTTP at /metrics",
|
Desc: "Don't expose metrics over HTTP at /metrics",
|
||||||
Default: o.MetricsDisabled,
|
Default: o.MetricsDisabled,
|
||||||
},
|
},
|
||||||
|
// UI Config
|
||||||
|
{
|
||||||
|
DestP: &o.UIDisabled,
|
||||||
|
Flag: "ui-disabled",
|
||||||
|
Default: o.UIDisabled,
|
||||||
|
Desc: "Disable the InfluxDB UI",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,6 +759,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
|
||||||
|
|
||||||
m.apibackend = &http.APIBackend{
|
m.apibackend = &http.APIBackend{
|
||||||
AssetsPath: opts.AssetsPath,
|
AssetsPath: opts.AssetsPath,
|
||||||
|
UIDisabled: opts.UIDisabled,
|
||||||
HTTPErrorHandler: kithttp.ErrorHandler(0),
|
HTTPErrorHandler: kithttp.ErrorHandler(0),
|
||||||
Logger: m.log,
|
Logger: m.log,
|
||||||
SessionRenewDisabled: opts.SessionRenewDisabled,
|
SessionRenewDisabled: opts.SessionRenewDisabled,
|
||||||
|
|
|
@ -34,6 +34,7 @@ type APIHandler struct {
|
||||||
// an APIHandler.
|
// an APIHandler.
|
||||||
type APIBackend struct {
|
type APIBackend struct {
|
||||||
AssetsPath string // if empty then assets are served from bindata.
|
AssetsPath string // if empty then assets are served from bindata.
|
||||||
|
UIDisabled bool // if true requests for the UI will return 404
|
||||||
Logger *zap.Logger
|
Logger *zap.Logger
|
||||||
errors.HTTPErrorHandler
|
errors.HTTPErrorHandler
|
||||||
SessionRenewDisabled bool
|
SessionRenewDisabled bool
|
||||||
|
|
|
@ -35,6 +35,10 @@ func NewPlatformHandler(b *APIBackend, opts ...APIHandlerOptFn) *PlatformHandler
|
||||||
h.RegisterNoAuthRoute("GET", "/api/v2/swagger.json")
|
h.RegisterNoAuthRoute("GET", "/api/v2/swagger.json")
|
||||||
|
|
||||||
assetHandler := static.NewAssetHandler(b.AssetsPath)
|
assetHandler := static.NewAssetHandler(b.AssetsPath)
|
||||||
|
if b.UIDisabled {
|
||||||
|
b.Logger.Debug("http server running with UI disabled")
|
||||||
|
assetHandler = http.NotFoundHandler()
|
||||||
|
}
|
||||||
|
|
||||||
wrappedHandler := kithttp.SetCORS(h)
|
wrappedHandler := kithttp.SetCORS(h)
|
||||||
wrappedHandler = kithttp.SkipOptions(wrappedHandler)
|
wrappedHandler = kithttp.SkipOptions(wrappedHandler)
|
||||||
|
|
Loading…
Reference in New Issue