go(app/settings): create a file for defaults
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2023-09-10 12:58:38 +02:00
parent 35435da9a6
commit b97e47ed1b
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
2 changed files with 19 additions and 13 deletions

18
app/settings/defaults.go Normal file

@ -0,0 +1,18 @@
// Copyright 2023 wanderer <a_mirre at utb dot cz>
// 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
)

@ -45,18 +45,6 @@ type Settings struct {
dehashedAPIKey string 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 var log slogging.Slogger
// cleantgt is a list of ENV vars pertaining to pcmt. // cleantgt is a list of ENV vars pertaining to pcmt.
@ -180,7 +168,7 @@ func (s *Settings) Port() int {
// AppName returns the appName. // AppName returns the appName.
func (s *Settings) AppName() string { func (s *Settings) AppName() string {
return appName return defaultAppName
} }
// AppPath returns the appPath. // AppPath returns the appPath.