config

package
v0.0.0-...-b75ba5b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListenPort = 3000
	DefaultListenHost = ""
	Prefix            = "BRUTAL"

	SessionsCookieBackend = "cookie"
	SessionsFSBackend     = "fs"
)
View Source
const (
	KeyENV                        = "ENV"
	KeyLogLevel                   = "LOG_LEVEL"
	KeyTimeOut                    = "TIME_OUT"
	KeyHostname                   = "HOSTNAME"
	KeyListenHostName             = "LISTEN_HOSTNAME"
	KeyListenPort                 = "LISTEN_PORT"
	KeyName                       = "NAME"
	KeyHTTPS                      = "HTTPS"
	KeyCertPath                   = "CERT_PATH"
	KeyKeyPath                    = "KEY_PATH"
	KeyAPIUrl                     = "API_URL"
	KeyDisableVoting              = "DISABLE_VOTING"
	KeyDisableDownVoting          = "DISABLE_DOWNVOTING"
	KeyDisablePublicVoting        = "DISABLE_PUBLIC_VOTING"
	KeyDisableSessions            = "DISABLE_SESSIONS"
	KeyDisableUserCreation        = "DISABLE_USER_CREATION"
	KeyDisableUserInvites         = "DISABLE_USER_INVITES"
	KeyDisableAnonymousCommenting = "DISABLE_ANONYMOUS_COMMENTING"
	KeyDisableUserFollowing       = "DISABLE_USER_FOLLOWING"
	KeyDisableModeration          = "DISABLE_MODERATION"
	KeyDisableCaching             = "DISABLE_CACHING"
	KeyAutoAcceptFollows          = "AUTO_ACCEPT_FOLLOWS"
	KeyAdminContact               = "ADMIN_CONTACT"

	KeyMaintenanceMode = "MAINTENANCE_MODE"

	KeyFedBOXOAuthApp    = "OAUTH2_APP"
	KeyFedBOXOAuthKey    = "OAUTH2_KEY"
	KeyFedBOXOAuthSecret = "OAUTH2_SECRET"

	KeySessionAuthKey = "SESS_AUTH_KEY"
	KeySessionEncKey  = "SESS_ENC_KEY"
	KeySessionBackend = "SESSIONS_BACKEND"
	KeySessionPath    = "SESSIONS_PATH"
)

Variables

View Source
var (
	Default = Configuration{Env: DEV}
)

Functions

func ValidEnv

func ValidEnv(env EnvType) bool

Types

type Configuration

type Configuration struct {
	HostName                   string
	Name                       string
	TimeOut                    time.Duration
	ListenPort                 int
	ListenHost                 string
	APIURL                     string
	Secure                     bool
	CertPath                   string
	KeyPath                    string
	Env                        EnvType
	LogLevel                   log.Level
	AdminContact               string
	AnonymousCommentingEnabled bool
	SessionsEnabled            bool
	VotingEnabled              bool
	DownvotingEnabled          bool
	PublicVotingEnabled        bool
	UserCreatingEnabled        bool
	UserInvitesEnabled         bool
	UserFollowingEnabled       bool
	ModerationEnabled          bool
	CachingEnabled             bool
	AutoAcceptFollows          bool
	MaintenanceMode            bool
	SessionKeys                [][]byte
	SessionsBackend            string
	SessionsPath               string
}

func Load

func Load(e EnvType, wait time.Duration) *Configuration

func (Configuration) GetOauth2Config

func (c Configuration) GetOauth2Config(provider string, localBaseURL string) oauth2.Config

func (Configuration) Listen

func (c Configuration) Listen() string

type EnvType

type EnvType string

EnvType type alias

const (
	// DEV environment
	DEV EnvType = "dev"
	// PROD environment
	PROD EnvType = "prod"
	// QA environment
	QA EnvType = "qa"
	// testing environment
	TEST EnvType = "test"
)

func (EnvType) IsDev

func (e EnvType) IsDev() bool

func (EnvType) IsProd

func (e EnvType) IsProd() bool

func (EnvType) IsQA

func (e EnvType) IsQA() bool

func (EnvType) IsTest

func (e EnvType) IsTest() bool

Jump to

Keyboard shortcuts

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