Documentation
¶
Overview ¶
Package config holds project and service related data and structures that define optional parameters for different parts of the service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Name is the name of the service. Name = "gopherpit" // Description is a service description. Description = "" // Author is the name of the service's author. Author = "Janoš Guljaš" // AuthorEmail is a contact address of the author. AuthorEmail = "janos@resenje.org" // Version is a string representing service's version. // Set the version on build with: go build -ldflags "-X gopherpit.com/gopherpit/server/config.Version=$(VERSION)" Version = "0" // BuildInfo is usually a git commit short hash. // Set the version on build with: go build -ldflags "-X gopherpit.com/gopherpit/server/config.BuildInfo=$(shell git describe --long --dirty --always)" BuildInfo = "" // UserAgent is a value for User-Agent HTTP request header value. UserAgent = func() string { if BuildInfo != "" { return fmt.Sprintf("%s/%s-%s", Name, Version, BuildInfo) } return fmt.Sprintf("%s/%s", Name, Version) }() // BaseDir is the directory where the service's executable is located. BaseDir = func() string { path, err := os.Executable() if err != nil { panic(err) } path, err = filepath.EvalSymlinks(path) if err != nil { panic(err) } return filepath.Dir(path) }() // Dir is default directory where configuration files are located. // Set the version on build with: go build -ldflags "-X gopherpit.com/gopherpit/server/config.Dir=$(CONFIG_DIR)" Dir = "/etc/gopherpit" )
Functions ¶
This section is empty.
Types ¶
type APIOptions ¶ added in v0.5.1
type APIOptions struct {
TrustedProxyCIDRs []string `json:"trusted-proxy-cidrs" yaml:"trusted-proxy-cidrs" envconfig:"TRUSTED_PROXY_CIDRS"`
ProxyRealIPHeader string `json:"proxy-real-ip-header" yaml:"proxy-real-ip-header" envconfig:"PROXY_REAL_IP_HEADER"`
HourlyRateLimit int `json:"hourly-rate-limit" yaml:"hourly-rate-limit" envconfig:"HOURLY_RATE_LIMIT"`
Disabled bool `json:"disabled" yaml:"disable" envconfig:"DISABLE"`
}
APIOptions defines parameters related to service's API functionality.
func NewAPIOptions ¶ added in v0.5.1
func NewAPIOptions() *APIOptions
NewAPIOptions initializes APIOptions with default values.
func (*APIOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *APIOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type CertificateOptions ¶
type CertificateOptions struct {
DirectoryURL string `json:"directory-url" yaml:"directory-url" envconfig:"DIRECTORY_URL"`
DirectoryURLStaging string `json:"directory-url-staging" yaml:"directory-url-staging" envconfig:"DIRECTORY_URL_STAGING"`
RenewPeriod marshal.Duration `json:"renew-period" yaml:"renew-period" envconfig:"RENEW_PERIOD"`
RenewCheckPeriod marshal.Duration `json:"renew-check-period" yaml:"renew-check-period" envconfig:"RENEW_CHECK_PERIOD"`
}
CertificateOptions defines parameters related to service's core functionality.
func NewCertificateOptions ¶
func NewCertificateOptions() *CertificateOptions
NewCertificateOptions initializes CertificateOptions with default values.
func (*CertificateOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *CertificateOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type EmailOptions ¶
type EmailOptions struct {
NotifyAddresses []string `json:"notify-addresses" yaml:"notify-addresses" envconfig:"NOTIFY_ADDRESS"`
DefaultFrom string `json:"default-from" yaml:"default-from" envconfig:"DEFAULT_FROM"`
SubjectPrefix string `json:"subject-prefix" yaml:"subject-prefix" envconfig:"SUBJECT_PREFIX"`
SMTPIdentity string `json:"smtp-identity" yaml:"smtp-identity" envconfig:"SMTP_IDENTITY"`
SMTPUsername string `json:"smtp-username" yaml:"smtp-username" envconfig:"SMTP_USERNAME"`
SMTPPassword string `json:"smtp-password" yaml:"smtp-password" envconfig:"SMTP_PASSWORD"`
SMTPHost string `json:"smtp-host" yaml:"smtp-host" envconfig:"SMTP_HOST"`
SMTPPort int `json:"smtp-port" yaml:"smtp-port" envconfig:"SMTP_PORT"`
SMTPSkipVerify bool `json:"smtp-skip-verify" yaml:"smtp-skip-verify" envconfig:"SMTP_SKIP_VERIFY"`
}
EmailOptions defines parameters for email sending.
func NewEmailOptions ¶
func NewEmailOptions() *EmailOptions
NewEmailOptions initializes EmailOptions with default values.
func (*EmailOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *EmailOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type GopherPitOptions ¶
type GopherPitOptions struct {
Listen string `json:"listen" yaml:"listen" envconfig:"LISTEN"`
ListenTLS string `json:"listen-tls" yaml:"listen-tls" envconfig:"LISTEN_TLS"`
ListenInternal string `json:"listen-internal" yaml:"listen-internal" envconfig:"LISTEN_INTERNAL"`
ListenInternalTLS string `json:"listen-internal-tls" yaml:"listen-internal-tls" envconfig:"LISTEN_INTERNAL_TLS"`
TLSCert string `json:"tls-cert" yaml:"tls-cert" envconfig:"TLS_CERT"`
TLSKey string `json:"tls-key" yaml:"tls-key" envconfig:"TLS_KEY"`
Brand string `json:"brand" yaml:"brand" envconfig:"BRAND"`
Domain string `json:"domain" yaml:"domain" envconfig:"DOMAIN"`
Headers map[string]string `json:"headers" yaml:"headers" envconfig:"HEADERS"`
SessionCookieName string `json:"session-cookie-name" yaml:"session-cookie-name" envconfig:"SESSION_COOKIE_NAME"`
Debug bool `json:"debug" yaml:"debug" envconfig:"DEBUG"`
PidFileName string `json:"pid-file" yaml:"pid-file" envconfig:"PID_FILE"`
PidFileMode marshal.Mode `json:"pid-file-mode" yaml:"pid-file-mode" envconfig:"PID_FILE_MODE"`
StorageFileMode marshal.Mode `json:"storage-file-mode" yaml:"storage-file-mode" envconfig:"STORAGE_FILE_MODE"`
StorageDir string `json:"storage-dir" yaml:"storage-dir" envconfig:"STORAGE_DIR"`
AssetsDir string `json:"assets-dir" yaml:"assets-dir" envconfig:"ASSETS_DIR"`
StaticDir string `json:"static-dir" yaml:"static-dir" envconfig:"STATIC_DIR"`
TemplatesDir string `json:"templates-dir" yaml:"templates-dir" envconfig:"TEMPLATES_DIR"`
MaintenanceFilename string `json:"maintenance-filename" yaml:"maintenance-filename" envconfig:"MAINTENANCE_FILENAME"`
GoogleAnalyticsID string `json:"google-analytics-id" yaml:"google-analytics-id" envconfig:"GOOGLE_ANALYTICS_ID"`
ContactRecipientEmail string `json:"contact-recipient-email" yaml:"contact-recipient-email" envconfig:"CONTACT_RECIPIENT_EMAIL"`
SkipDomainVerification bool `json:"skip-domain-verification" yaml:"skip-domain-verification" envconfig:"SKIP_DOMAIN_VERIFICATION"`
VerificationSubdomain string `json:"verification-subdomain" yaml:"verification-subdomain" envconfig:"VERIFICATION_SUBDOMAIN"`
TrustedDomains []string `json:"trusted-domains" yaml:"trusted-domains" envconfig:"TRUSTED_DOMAINS"`
ForbiddenDomains []string `json:"forbidden-domains" yaml:"forbidden-domains" envconfig:"FORBIDDEN_DOMAINS"`
}
GopherPitOptions defines parameters related to service's core functionality.
func NewGopherPitOptions ¶
func NewGopherPitOptions() *GopherPitOptions
NewGopherPitOptions initializes GopherPitOptions with default values.
func (*GopherPitOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *GopherPitOptions) VerifyAndPrepare() (err error)
VerifyAndPrepare implements application.Options interface.
type LDAPOptions ¶ added in v0.2.1
type LDAPOptions struct {
Enabled bool `json:"enabled" yaml:"enabled" envconfig:"ENABLED"`
Host string `json:"host" yaml:"host" envconfig:"HOST"`
Port uint `json:"port" yaml:"port" envconfig:"PORT"`
Secure bool `json:"secure" yaml:"secure" envconfig:"SECURE"`
Username string `json:"username" yaml:"username" envconfig:"USERNAME"`
Password string `json:"password" yaml:"password" envconfig:"PASSWORD"`
DN string `json:"dn" yaml:"dn" envconfig:"DN"`
DNUsers string `json:"dn-users" yaml:"dn-users" envconfig:"DN_USERS"`
DNGroups string `json:"dn-groups" yaml:"dn-groups" envconfig:"DN_GROUPS"`
AttributeUsername string `json:"attribute-username" yaml:"attribute-username" envconfig:"ATTRIBUTE_USERNAME"`
AttributeName string `json:"attribute-name" yaml:"attribute-name" envconfig:"ATTRIBUTE_NAME"`
AttributeEmail string `json:"attribute-email" yaml:"attribute-email" envconfig:"ATTRIBUTE_EMAIL"`
AttributeGroupID string `json:"attribute-group-id" yaml:"attribute-group-id" envconfig:"ATTRIBUTE_GROUP_ID"`
AttributeGroupMember string `json:"attribute-group-member" yaml:"attribute-group-member" envconfig:"ATTRIBUTE_GROUP_MEMBER"`
Groups []string `json:"groups" yaml:"groups" envconfig:"GROUPS"`
MaxConnections int `json:"max-connections" yaml:"max-connections" envconfig:"MAX_CONNECTIONS"`
Timeout marshal.Duration `json:"timeout" yaml:"timeout" envconfig:"TIMEOUT"`
}
LDAPOptions defines parameters for LDAP authentication.
func NewLDAPOptions ¶ added in v0.2.1
func NewLDAPOptions() *LDAPOptions
NewLDAPOptions initializes LDAPOptions with default values.
func (*LDAPOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *LDAPOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type LoggingOptions ¶
type LoggingOptions struct {
LogDir string `json:"log-dir" yaml:"log-dir" envconfig:"LOG_DIR"`
LogLevel logging.Level `json:"log-level" yaml:"log-level" envconfig:"LOG_LEVEL"`
SyslogFacility logging.SyslogFacility `json:"syslog-facility" yaml:"syslog-facility" envconfig:"SYSLOG_FACILITY"`
SyslogTag string `json:"syslog-tag" yaml:"syslog-tag" envconfig:"SYSLOG_TAG"`
SyslogNetwork string `json:"syslog-network" yaml:"syslog-network" envconfig:"SYSLOG_NETWORK"`
SyslogAddress string `json:"syslog-address" yaml:"syslog-address" envconfig:"SYSLOG_ADDRESS"`
AccessLogLevel logging.Level `json:"access-log-level" yaml:"access-log-level" envconfig:"ACCESS_LOG_LEVEL"`
AccessSyslogFacility logging.SyslogFacility `json:"access-syslog-facility" yaml:"access-syslog-facility" envconfig:"ACCESS_SYSLOG_FACILITY"`
AccessSyslogTag string `json:"access-syslog-tag" yaml:"access-syslog-tag" envconfig:"ACCESS_SYSLOG_TAG"`
PackageAccessLogLevel logging.Level `json:"package-access-log-level" yaml:"package-access-log-level" envconfig:"PACKAGE_ACCESS_LOG_LEVEL"`
PackageAccessSyslogFacility logging.SyslogFacility `json:"package-access-syslog-facility" yaml:"package-access-syslog-facility" envconfig:"PACKAGE_ACCESS_SYSLOG_FACILITY"`
PackageAccessSyslogTag string `json:"package-access-syslog-tag" yaml:"package-access-syslog-tag" envconfig:"PACKAGE_ACCESS_SYSLOG_TAG"`
AuditLogLevel logging.Level `json:"audit-log-level" yaml:"audit-log-level" envconfig:"AUDIT_LOG_LEVEL"`
AuditSyslogFacility logging.SyslogFacility `json:"audit-syslog-facility" yaml:"audit-syslog-facility" envconfig:"AUDIT_SYSLOG_FACILITY"`
AuditSyslogTag string `json:"audit-syslog-tag" yaml:"audit-syslog-tag" envconfig:"AUDIT_SYSLOG_TAG"`
DaemonLogFileName string `json:"daemon-log-file" yaml:"daemon-log-file" envconfig:"DAEMON_LOG_FILE"`
DaemonLogFileMode marshal.Mode `json:"daemon-log-file-mode" yaml:"daemon-log-file-mode" envconfig:"DAEMON_LOG_FILE_MODE"`
}
LoggingOptions defines parameters related to service's core functionality.
func NewLoggingOptions ¶
func NewLoggingOptions() *LoggingOptions
NewLoggingOptions initializes LoggingOptions with default values.
func (*LoggingOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *LoggingOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type ServicesOptions ¶
type ServicesOptions struct {
UserEndpoint string `json:"user-endpoint" yaml:"user-endpoint" envconfig:"USER_ENDPOINT"`
UserKey string `json:"user-key" yaml:"user-key" envconfig:"USER_KEY"`
UserOptions *httpClient.Options `json:"user-options" yaml:"user-options" envconfig:"USER_OPTIONS"`
SessionEndpoint string `json:"session-endpoint" yaml:"session-endpoint" envconfig:"SESSION_ENDPOINT"`
SessionKey string `json:"session-key" yaml:"session-key" envconfig:"SESSION_KEY"`
SessionOptions *httpClient.Options `json:"session-options" yaml:"session-options" envconfig:"SESSION_OPTIONS"`
NotificationEndpoint string `json:"notification-endpoint" yaml:"notification-endpoint" envconfig:"NOTIFICATION_ENDPOINT"`
NotificationKey string `json:"notification-key" yaml:"notification-key" envconfig:"NOTIFICATION_KEY"`
NotificationOptions *httpClient.Options `json:"notification-options" yaml:"notification-options" envconfig:"NOTIFICATION_OPTIONS"`
CertificateEndpoint string `json:"certificate-endpoint" yaml:"certificate-endpoint" envconfig:"CERTIFICATE_ENDPOINT"`
CertificateKey string `json:"certificate-key" yaml:"certificate-key" envconfig:"CERTIFICATE_KEY"`
CertificateOptions *httpClient.Options `json:"certificate-options" yaml:"certificate-options" envconfig:"CERTIFICATE_OPTIONS"`
PackagesEndpoint string `json:"packages-endpoint" yaml:"packages-endpoint" envconfig:"PACKAGES_ENDPOINT"`
PackagesKey string `json:"packages-key" yaml:"packages-key" envconfig:"PACKAGES_KEY"`
PackagesOptions *httpClient.Options `json:"packages-options" yaml:"packages-options" envconfig:"PACKAGES_OPTIONS"`
KeyEndpoint string `json:"key-endpoint" yaml:"key-endpoint" envconfig:"KEY_ENDPOINT"`
KeyKey string `json:"key-key" yaml:"key-key" envconfig:"KEY_KEY"`
KeyOptions *httpClient.Options `json:"key-options" yaml:"key-options" envconfig:"KEY_OPTIONS"`
GCRAStoreEndpoint string `json:"gcra-store-endpoint" yaml:"gcra-store-endpoint" envconfig:"GCRASTORE_ENDPOINT"`
GCRAStoreKey string `json:"gcra-store-key" yaml:"gcra-store-key" envconfig:"GCRASTORE_KEY"`
GCRAStoreOptions *httpClient.Options `json:"gcra-store-options" yaml:"gcra-store-options" envconfig:"GCRASTORE_OPTIONS"`
}
ServicesOptions defines parameters for communication with external services.
func NewServicesOptions ¶
func NewServicesOptions() *ServicesOptions
NewServicesOptions initializes ServicesOptions with empty values.
func (*ServicesOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *ServicesOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type SessionOptions ¶
type SessionOptions struct {
CleanupPeriod marshal.Duration `json:"cleanup-period" yaml:"cleanup-period" envconfig:"CLEANUP_PERIOD"`
DefaultLifetime marshal.Duration `json:"default-lifetime" yaml:"default-lifetime" envconfig:"DEFAULT_LIFETIME"`
}
SessionOptions defines parameters related to session storage.
func NewSessionOptions ¶
func NewSessionOptions() *SessionOptions
NewSessionOptions initializes SessionOptions with default values.
func (*SessionOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *SessionOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.
type UserOptions ¶
type UserOptions struct {
RememberMeDays int `json:"remember-me-days" yaml:"remember-me-days" envconfig:"REMEMBER_ME_DAYS"`
PasswordNoReuseMonths int `json:"password-no-reuse-months" yaml:"password-no-reuse-months" envconfig:"PASSWORD_NO_REUSE_MONTHS"`
}
UserOptions defines parameters related to the user management.
func NewUserOptions ¶
func NewUserOptions() *UserOptions
NewUserOptions initializes UserOptions with default values.
func (*UserOptions) VerifyAndPrepare ¶ added in v0.5.3
func (o *UserOptions) VerifyAndPrepare() error
VerifyAndPrepare implements application.Options interface.