diff --git a/README.md b/README.md index 14241bc..6554c6c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Usage of Falcosidekick-UI: -d boolean Disable authentication (environment "FALCOSIDEKICK_UI_DISABLEAUTH") -l string - Log level: "debug", "info", "warning", "error" (default "info", environment "FALCOSIDEKICK_UI_LOGLEVEL") + Log level: "debug", "info", "warning", "error" (default "info", environment "FALCOSIDEKICK_UI_LOGLEVEL") -p int Listen Port (default "2802", environment "FALCOSIDEKICK_UI_PORT") -r string @@ -38,7 +38,7 @@ Usage of Falcosidekick-UI: -v boolean Display version -w string - Redis password (default "", environment "FALCOSIDEKICK_REDIS_PASSWORD") + Redis password (default "", environment "FALCOSIDEKICK_UI_REDIS_PASSWORD") -x boolean Allow CORS for development (environment "FALCOSIDEKICK_UI_DEV") ``` diff --git a/frontend/src/http.js b/frontend/src/http.js index 76e4147..e53d3c3 100644 --- a/frontend/src/http.js +++ b/frontend/src/http.js @@ -4,7 +4,7 @@ import store from './store'; const production = process.env.NODE_ENV === 'production'; const api = axios.create({ - baseURL: `${production ? `//${window.location.host}` : process.env.VUE_APP_API}/api/v1`, + baseURL: `${production ? `//${window.location.host}${window.location.pathname}` : process.env.VUE_APP_API}api/v1`, headers: { 'Content-type': 'application/json', 'Access-Control-Allow-Origin': '*', diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 65b6f7d..0f679c8 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -44,7 +44,7 @@ const routes = [ ]; const router = new VueRouter({ - mode: 'history', + mode: 'hash', base: process.env.BASE_URL, routes, }); diff --git a/frontend/vue.config.js b/frontend/vue.config.js new file mode 100644 index 0000000..fdb4f9e --- /dev/null +++ b/frontend/vue.config.js @@ -0,0 +1,3 @@ +module.exports = { + publicPath: './', +}; diff --git a/main.go b/main.go index cae095f..a2d966d 100644 --- a/main.go +++ b/main.go @@ -39,13 +39,13 @@ func init() { disableauth := utils.GetBoolFlagOrEnvParam("d", "FALCOSIDEKICK_UI_DISABLEAUTH", false, "Disable authentication") flag.Usage = func() { - help := `Usage of Falcosidekick-UI: + help := `Usage of Falcosidekick-UI: -a string Listen Address (default "0.0.0.0", environment "FALCOSIDEKICK_UI_ADDR") -d boolean Disable authentication (environment "FALCOSIDEKICK_UI_DISABLEAUTH") --l string - Log level: "debug", "info", "warning", "error" (default "info", environment "FALCOSIDEKICK_UI_LOGLEVEL") +-l string + Log level: "debug", "info", "warning", "error" (default "info", environment "FALCOSIDEKICK_UI_LOGLEVEL") -p int Listen Port (default "2802", environment "FALCOSIDEKICK_UI_PORT") -r string @@ -53,12 +53,12 @@ func init() { -t string TTL for keys, the format is X, with unit (s, m, h, d, W, M, y)" (default "0", environment "FALCOSIDEKICK_UI_TTL") --u string +-u string User in format : (default "admin:admin", environment "FALCOSIDEKICK_UI_USER") -v boolean Display version --w string - Redis password (default "", environment "FALCOSIDEKICK_REDIS_PASSWORD") +-w string + Redis password (default "", environment "FALCOSIDEKICK_UI_REDIS_PASSWORD") -x boolean Allow CORS for development (environment "FALCOSIDEKICK_UI_DEV") ` @@ -117,39 +117,31 @@ func init() { func main() { e := echo.New() v := &CustomValidator{validator: validator.New()} - c := configuration.GetConfiguration() + config := configuration.GetConfiguration() e.Validator = v e.HideBanner = true e.HidePort = true - if c.DevMode { + if config.DevMode { utils.WriteLog("warning", "DEV mode enabled") e.Use(middleware.CORS()) } - if c.DisableAuth { + if config.DisableAuth { utils.WriteLog("warning", "Auhentication disabled") e.Use(middleware.CORS()) } - utils.WriteLog("info", fmt.Sprintf("Falcosidekick UI is listening on %v:%v", c.ListenAddress, c.ListenPort)) - utils.WriteLog("info", fmt.Sprintf("log level is %v", c.LogLevel)) + + utils.WriteLog("info", fmt.Sprintf("Falcosidekick UI is listening on %v:%v", config.ListenAddress, config.ListenPort)) + utils.WriteLog("info", fmt.Sprintf("Log level is %v", config.LogLevel)) e.GET("/docs/*", echoSwagger.WrapHandler) e.GET("/docs", func(c echo.Context) error { - if err := c.Redirect(http.StatusPermanentRedirect, "docs/"); err != nil { - return err - } - return nil + return c.Redirect(http.StatusPermanentRedirect, "docs/") }) e.Static("/*", "frontend/dist").Name = "webui-home" - e.Static("/dashboard", "frontend/dist").Name = "webui-dashboard" - e.Static("/events", "frontend/dist").Name = "webui-events" - e.Static("/info", "frontend/dist").Name = "webui-info" - e.Static("/login", "frontend/dist").Name = "webui-login" e.POST("/", api.AddEvent).Name = "add-event" // for compatibility with old Falcosidekicks - - // e.Use(middleware.BodyDump(func(c echo.Context, reqBody, resBody []byte) { - // })) + e.POST("/", api.AddEvent).Name = "add-event" // for compatibility with old Falcosidekicks apiRoute := e.Group("/api/v1") apiRoute.Use(middleware.BasicAuthWithConfig(middleware.BasicAuthConfig{ @@ -192,7 +184,7 @@ func main() { eventsRoute.GET("/count/:groupby", api.CountByEvent).Name = "count-events-by" eventsRoute.GET("/search", api.Search).Name = "search-keys" - e.Logger.Fatal(e.Start(fmt.Sprintf("%v:%v", c.ListenAddress, c.ListenPort))) + e.Logger.Fatal(e.Start(fmt.Sprintf("%v:%v", config.ListenAddress, config.ListenPort))) } func (cv *CustomValidator) Validate(i interface{}) error {