diff --git a/app/settings/defaults.go b/app/settings/defaults.go new file mode 100644 index 0000000..3f81ff0 --- /dev/null +++ b/app/settings/defaults.go @@ -0,0 +1,18 @@ +// Copyright 2023 wanderer +// SPDX-License-Identifier: AGPL-3.0-only + +package settings + +import "time" + +const ( + defaultAppName = "pcmt" + defaultPort = 3000 + defaultSessionMaxAge = 86400 // seconds. + defaultHTTPDomain = "localhost" + defaultCSP = "upgrade-insecure-requests; default-src 'self'; manifest-src 'self'; font-src 'self'; connect-src 'self'; script-src 'self'; style-src 'self'; object-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'" + defaultCSPDevel = "default-src 'self'; manifest-src 'self'; font-src 'self'; connect-src 'self' ws://localhost:3002 http://localhost:3002; script-src 'self' http://localhost:3002; style-src 'self'; object-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'" + defaultServerWriteTimeout = 30 * time.Second + defaultServerReadHeaderTimeout = 30 * time.Second + defaultLoggerSkipAssets = true +) diff --git a/app/settings/settings.go b/app/settings/settings.go index 0d913f7..a7beb86 100644 --- a/app/settings/settings.go +++ b/app/settings/settings.go @@ -45,18 +45,6 @@ type Settings struct { dehashedAPIKey string } -const ( - appName = "pcmt" - defaultPort = 3000 - defaultSessionMaxAge = 86400 // seconds. - defaultHTTPDomain = "localhost" - defaultCSP = "upgrade-insecure-requests; default-src 'self'; manifest-src 'self'; font-src 'self'; connect-src 'self'; script-src 'self'; style-src 'self'; object-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'" - defaultCSPDevel = "default-src 'self'; manifest-src 'self'; font-src 'self'; connect-src 'self' ws://localhost:3002 http://localhost:3002; script-src 'self' http://localhost:3002; style-src 'self'; object-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'" - defaultServerWriteTimeout = 30 * time.Second - defaultServerReadHeaderTimeout = 30 * time.Second - defaultLoggerSkipAssets = true -) - var log slogging.Slogger // cleantgt is a list of ENV vars pertaining to pcmt. @@ -180,7 +168,7 @@ func (s *Settings) Port() int { // AppName returns the appName. func (s *Settings) AppName() string { - return appName + return defaultAppName } // AppPath returns the appPath.