settings

package
v0.0.0-...-4d10510 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	RegistrationAllowed bool
	// contains filtered or unexported fields
}

func New

func New() *Settings

New returns a new instance of the settings struct.

func (*Settings) APIKeyDehashed

func (s *Settings) APIKeyDehashed() string

APIKeyDehashed returns the dehashedAPIKey.

func (*Settings) APIKeyHIBP

func (s *Settings) APIKeyHIBP() string

APIKeyHIBP returns the hibpAPIKey.

func (*Settings) AppName

func (s *Settings) AppName() string

AppName returns the appName.

func (*Settings) AppPath

func (s *Settings) AppPath() string

AppPath returns the appPath.

func (*Settings) AssetsPath

func (s *Settings) AssetsPath() string

AssetsPath returns the assetsPath.

func (*Settings) Consolidate

func (s *Settings) Consolidate(conf *config.Config, host *string, port *int, devel *bool, version string)

Consolidate reconciles whatever values are set in config and via flags and sets it to one place that should be regarded as a single source of truth - the settings struct. Order of preference for values is (from higher to lower) as follows: flag -> Env var -> configuration file.

func (*Settings) DbConnstring

func (s *Settings) DbConnstring() string

DbConnstring returns the dbConnString.

func (*Settings) DbIsSetUp

func (s *Settings) DbIsSetUp() bool

DbIsSetUp returns the dbIsSetUp.

func (*Settings) DbType

func (s *Settings) DbType() string

DbType returns the dbType.

func (*Settings) DefaultLoggerSkipAssets

func (s *Settings) DefaultLoggerSkipAssets() bool

DefaultLoggerSkipAssets returns whether the logger skips reporting asset visits.

func (*Settings) DefaultServerReadHeaderTimeout

func (s *Settings) DefaultServerReadHeaderTimeout() time.Duration

DefaultServerReadHeaderTimeout returns the server default read header timeout.

func (*Settings) DefaultServerWriteTimeout

func (s *Settings) DefaultServerWriteTimeout() time.Duration

DefaultServerWriteTimeout returns the server default write timeout.

func (*Settings) EraseENVs

func (s *Settings) EraseENVs() error

EraseENVs attempts to clear environment vars pertaining to pcmt.

func (*Settings) HTTPCSP

func (s *Settings) HTTPCSP() string

HTTPCSP returns the httpCSP.

func (*Settings) HTTPDomain

func (s *Settings) HTTPDomain() string

HTTPDomain returns the httpDomain.

func (*Settings) HTTPGzipEnabled

func (s *Settings) HTTPGzipEnabled() bool

HTTPGzipEnabled returns the httpGzipEnabled variable.

func (*Settings) HTTPGzipLevel

func (s *Settings) HTTPGzipLevel() int

HTTPGzipLevel returns the httpGzipLevel.

func (*Settings) HTTPRateLimit

func (s *Settings) HTTPRateLimit() int

HTTPRateLimit returns the httpRateLimit.

func (*Settings) HTTPRateLimitEnabled

func (s *Settings) HTTPRateLimitEnabled() bool

HTTPRateLimitEnabled returns the httpRateLimitEnabled variable.

func (*Settings) HTTPSecure

func (s *Settings) HTTPSecure() bool

HTTPSecure returns the httpSecure.

func (*Settings) Host

func (s *Settings) Host() string

Host returns the host.

func (*Settings) InitAdminPassword

func (s *Settings) InitAdminPassword() string

InitAdminPassword returns the value of initAdminPassword of the receiver.

func (*Settings) InitCreateAdmin

func (s *Settings) InitCreateAdmin() bool

InitCreateAdmin returns the value of initCreateAdmin of the receiver.

func (*Settings) IsDevel

func (s *Settings) IsDevel() bool

IsDevel returns the value of isDevel of the receiver.

func (*Settings) IsLive

func (s *Settings) IsLive() bool

IsLive returns the value of isLive of the receiver.

func (*Settings) LoggerIsJSON

func (s *Settings) LoggerIsJSON() bool

LoggerIsJSON returns whether the logger should use the JSON handler.

func (*Settings) Port

func (s *Settings) Port() int

Port returns the port.

func (*Settings) SessionAuthIsHex

func (s *Settings) SessionAuthIsHex() bool

SessionAuthIsHex returns whether the session cookie authentication secret is hex.

func (*Settings) SessionCookieAuthSecret

func (s *Settings) SessionCookieAuthSecret() string

SessionCookieAuthSecret returns the session cookie authentication secret.

func (*Settings) SessionCookieEncrSecret

func (s *Settings) SessionCookieEncrSecret() string

SessionCookieEncrSecret returns the session cookie encryption secret.

func (*Settings) SessionCookieName

func (s *Settings) SessionCookieName() string

SessionCookieName returns the name of the session cookie.

func (*Settings) SessionEncrIsHex

func (s *Settings) SessionEncrIsHex() bool

SessionEncrIsHex returns whether the session cookie encryption secret is hex.

func (*Settings) SessionMaxAge

func (s *Settings) SessionMaxAge() int

SessionMaxAge returns the session cookie MaxAge value.

func (*Settings) SetAPIKeyDehashed

func (s *Settings) SetAPIKeyDehashed(k string)

SetAPIKeyDehashed sets the dehashedAPIKey.

func (*Settings) SetAPIKeyHIBP

func (s *Settings) SetAPIKeyHIBP(k string)

SetAPIKeyHIBP sets the hibpAPIKey.

func (*Settings) SetAppPath

func (s *Settings) SetAppPath(appPath string)

SetAppPath sets the appPath.

func (*Settings) SetAssetsPath

func (s *Settings) SetAssetsPath(assetsPath string)

SetAssetsPath sets the assetsPath.

func (*Settings) SetDbConnstring

func (s *Settings) SetDbConnstring(connstring string)

SetDbConnstring sets the dbConnString.

func (*Settings) SetDbIsSetUp

func (s *Settings) SetDbIsSetUp(is bool)

SetDbIsSetUp sets the dbIsSetUp.

func (*Settings) SetDbType

func (s *Settings) SetDbType(dbType string)

SetDbType sets the dbType.

func (*Settings) SetHTTPCSP

func (s *Settings) SetHTTPCSP(csp string)

SetHTTPCSP sets the content security policy.

func (*Settings) SetHTTPDomain

func (s *Settings) SetHTTPDomain(domain string)

SetHTTPDomain sets the httpDomain.

func (*Settings) SetHTTPGzipEnabled

func (s *Settings) SetHTTPGzipEnabled(enabled bool)

SetHTTPGzipEnabled sets the httpGzipEnabled variable.

func (*Settings) SetHTTPGzipLevel

func (s *Settings) SetHTTPGzipLevel(level int)

SetHTTPGzipLevel sets the httpGzipLevel.

func (*Settings) SetHTTPRateLimit

func (s *Settings) SetHTTPRateLimit(rateLimit int)

SetHTTPRateLimit sets the httpRateLimit.

func (*Settings) SetHTTPRateLimitEnabled

func (s *Settings) SetHTTPRateLimitEnabled(enabled bool)

SetHTTPRateLimitEnabled sets the httpRateLimitEnabled variable.

func (*Settings) SetHTTPSecure

func (s *Settings) SetHTTPSecure(secure bool)

SetHTTPSecure sets the httpSecure.

func (*Settings) SetHost

func (s *Settings) SetHost(host string)

SetHost sets the host.

func (*Settings) SetInitAdminPassword

func (s *Settings) SetInitAdminPassword(password string)

SetInitAdminPassword sets the value of initAdminPassword of the receiver.

func (*Settings) SetInitCreateAdmin

func (s *Settings) SetInitCreateAdmin(create bool)

SetInitCreateAdmin sets the value of initCreateAdmin of the receiver.

func (*Settings) SetIsDevel

func (s *Settings) SetIsDevel(devel bool)

SetIsDevel sets the value of isDevel of the receiver.

func (*Settings) SetIsLive

func (s *Settings) SetIsLive(live bool)

SetIsLive sets the value of isLive of the receiver.

func (*Settings) SetLoggerIsJSON

func (s *Settings) SetLoggerIsJSON(isJSON bool)

SetLoggerIsJSON sets the setting value of loggerIsJSON.

func (*Settings) SetPort

func (s *Settings) SetPort(port int)

SetPort sets the port.

func (*Settings) SetSessionCookieAuthSecret

func (s *Settings) SetSessionCookieAuthSecret(sessionCookieAuthSecret string)

SetSessionCookieAuthSecret sets the session cookie authentication secret.

func (*Settings) SetSessionCookieEncrSecret

func (s *Settings) SetSessionCookieEncrSecret(sessionCookieEncrSecret string)

SetSessionCookieEncrSecret sets the session cookie encryption secret.

func (*Settings) SetSessionCookieName

func (s *Settings) SetSessionCookieName(sessionCookieName string)

SetSessionCookieName sets session cookie name.

func (*Settings) SetSessionMaxAge

func (s *Settings) SetSessionMaxAge(sessionMaxAge int)

SetSessionMaxAge sets sessionMaxAge.

func (*Settings) SetTemplatesPath

func (s *Settings) SetTemplatesPath(templatesPath string)

SetTemplatesPath sets the templatesPath.

func (*Settings) SetVersion

func (s *Settings) SetVersion(version string)

SetVersion sets the version.

func (*Settings) TemplatesPath

func (s *Settings) TemplatesPath() string

TemplatesPath returns the templatesPath.

func (*Settings) Version

func (s *Settings) Version() string

Version returns the version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL