diff --git a/internal/config/config.go b/internal/config/config.go index cb8f25cc..3f86a681 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -54,6 +54,7 @@ type Config struct { APIBaseURL string // Base URL for API Debug bool // Enable debug mode (verbose logging) LogFormat string // Log format + TimeZone string // The server time zone } type TLS struct { @@ -178,6 +179,7 @@ func bindEnvs() { _ = viper.BindEnv("navbarColor", "DAGU_NAVBAR_COLOR") _ = viper.BindEnv("navbarTitle", "DAGU_NAVBAR_TITLE") _ = viper.BindEnv("apiBaseURL", "DAGU_API_BASE_URL") + _ = viper.BindEnv("timeZone", "DAGU_TIME_ZONE") // Basic authentication _ = viper.BindEnv("isBasicAuth", "DAGU_IS_BASICAUTH") diff --git a/internal/frontend/frontend.go b/internal/frontend/frontend.go index 49eea471..072c8802 100644 --- a/internal/frontend/frontend.go +++ b/internal/frontend/frontend.go @@ -43,6 +43,7 @@ func New(cfg *config.Config, lg logger.Logger, cli client.Client) *server.Server NavbarColor: cfg.NavbarColor, NavbarTitle: cfg.NavbarTitle, APIBaseURL: cfg.APIBaseURL, + TimeZone: cfg.TimeZone, } if cfg.IsAuthToken { diff --git a/internal/frontend/server/server.go b/internal/frontend/server/server.go index a702efea..e768f9b4 100644 --- a/internal/frontend/server/server.go +++ b/internal/frontend/server/server.go @@ -63,6 +63,7 @@ type NewServerArgs struct { NavbarColor string NavbarTitle string APIBaseURL string + TimeZone string } type BasicAuth struct { @@ -92,6 +93,7 @@ func New(params NewServerArgs) *Server { NavbarColor: params.NavbarColor, NavbarTitle: params.NavbarTitle, APIBaseURL: params.APIBaseURL, + TimeZone: params.TimeZone, }, } } diff --git a/internal/frontend/server/templates.go b/internal/frontend/server/templates.go index 19147623..7ca88352 100644 --- a/internal/frontend/server/templates.go +++ b/internal/frontend/server/templates.go @@ -57,6 +57,7 @@ type funcsConfig struct { NavbarColor string NavbarTitle string APIBaseURL string + TimeZone string } func defaultFunctions(cfg funcsConfig) template.FuncMap { @@ -80,6 +81,9 @@ func defaultFunctions(cfg funcsConfig) template.FuncMap { "apiURL": func() string { return cfg.APIBaseURL }, + "timeZone": func() string { + return cfg.TimeZone + }, } } diff --git a/internal/frontend/templates/base.gohtml b/internal/frontend/templates/base.gohtml index 4b921bf2..dccc1bb2 100644 --- a/internal/frontend/templates/base.gohtml +++ b/internal/frontend/templates/base.gohtml @@ -1,27 +1,26 @@ {{define "base"}} - -
- - - -