config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

This package defines environment configuration for Cookie settings

Index

Constants

This section is empty.

Variables

View Source
var (
	DriverOptions = []string{"postgres"}
)

Functions

func GenerateKeyPair

func GenerateKeyPair(bitsize int) (*rsa.PrivateKey, *rsa.PublicKey, error)

Types

type Config

type Config struct {
	AppPort            string
	Environment        string
	DBDriver           string
	DBConnectionString string
	DBDebug            bool
	JWTSecret          string
	JWTPrivateKey      *rsa.PrivateKey
	JWTPublicKey       *rsa.PublicKey
	APIAllowedOrigins  []string
	MetricsEnabled     bool
	MetricsPort        string
	WebBaseURL         string
	SSO                *SSOConfig
	Email              *EmailConfig
}

func NewConfig

func NewConfig(logger *zap.SugaredLogger) *Config

type EmailConfig added in v0.6.0

type EmailConfig struct {
	Enabled   bool                     `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	Provider  string                   `yaml:"provider" json:"provider" mapstructure:"provider"` // default provider to use
	Providers *SupportedEmailProviders `yaml:"providers" json:"providers" mapstructure:"providers"`
}

func LoadEmailConfig added in v0.6.0

func LoadEmailConfig(path string) (*EmailConfig, error)

func (*EmailConfig) GetDefaultProvider added in v0.6.0

func (c *EmailConfig) GetDefaultProvider() EmailProviderSettings

func (*EmailConfig) GetEnabledProviders added in v0.6.0

func (c *EmailConfig) GetEnabledProviders() []EmailProviderSettings

func (*EmailConfig) GetProvider added in v0.6.0

func (c *EmailConfig) GetProvider(name string) EmailProviderSettings

type EmailProviderSettings added in v0.6.0

type EmailProviderSettings interface {
	GetName() string
	GetType() string
	IsEnabled() bool
}

EmailProviderSettings represents common behaviors for all provider-specific configs.

type EnvironmentType added in v0.5.0

type EnvironmentType string
const (
	EnvironmentProduction  EnvironmentType = "production"
	EnvironmentLocal       EnvironmentType = "local"
	EnvironmentDevelopment EnvironmentType = "development"
	EnvironmentEmpty       EnvironmentType = ""
)

type SESConfig added in v0.6.0

type SESConfig struct {
	Name            string `yaml:"name" json:"name" mapstructure:"name"`
	Enabled         bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	Region          string `yaml:"region" json:"region" mapstructure:"region"`
	AccessKeyID     string `yaml:"access_key_id" json:"accessKeyId" mapstructure:"access_key_id"`
	SecretAccessKey string `yaml:"secret_access_key" json:"secretAccessKey" mapstructure:"secret_access_key"`
	SessionToken    string `yaml:"session_token" json:"sessionToken" mapstructure:"session_token"`
	From            string `yaml:"from" json:"from" mapstructure:"from"`
	FromName        string `yaml:"from_name" json:"fromName" mapstructure:"from_name"`
}

func (*SESConfig) GetName added in v0.6.0

func (c *SESConfig) GetName() string

func (*SESConfig) GetType added in v0.6.0

func (c *SESConfig) GetType() string

func (*SESConfig) IsEnabled added in v0.6.0

func (c *SESConfig) IsEnabled() bool

type SMTPConfig added in v0.6.0

type SMTPConfig struct {
	Name     string `yaml:"name" json:"name" mapstructure:"name"`
	Enabled  bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	Host     string `yaml:"host" json:"host" mapstructure:"host"`
	Port     int    `yaml:"port" json:"port" mapstructure:"port"`
	Username string `yaml:"username" json:"username" mapstructure:"username"`
	Password string `yaml:"password" json:"password" mapstructure:"password"`
	From     string `yaml:"from" json:"from" mapstructure:"from"`
	FromName string `yaml:"from_name" json:"fromName" mapstructure:"from_name"`
	UseTLS   bool   `yaml:"use_tls" json:"useTls" mapstructure:"use_tls"`
	UseSSL   bool   `yaml:"use_ssl" json:"useSsl" mapstructure:"use_ssl"`
}

func (*SMTPConfig) GetName added in v0.6.0

func (c *SMTPConfig) GetName() string

func (*SMTPConfig) GetType added in v0.6.0

func (c *SMTPConfig) GetType() string

func (*SMTPConfig) IsEnabled added in v0.6.0

func (c *SMTPConfig) IsEnabled() bool

type SSOConfig added in v0.5.0

type SSOConfig struct {
	Enabled     bool                         `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	BaseURL     string                       `yaml:"base_url" json:"base_url" mapstructure:"base_url"`
	CallbackURL string                       `yaml:"callback_url" json:"callback_url" mapstructure:"callback_url"`
	Providers   map[string]SSOProviderConfig `yaml:"providers" json:"providers" mapstructure:"providers"`
}

func LoadSSOConfig added in v0.5.0

func LoadSSOConfig(path string) (*SSOConfig, error)

func (*SSOConfig) GetEnabledProviders added in v0.5.0

func (c *SSOConfig) GetEnabledProviders() []SSOProviderConfig

func (*SSOConfig) GetProvider added in v0.5.0

func (c *SSOConfig) GetProvider(name string) *SSOProviderConfig

type SSOProviderConfig added in v0.5.0

type SSOProviderConfig struct {
	Name                string              `yaml:"name" json:"name" mapstructure:"name"`
	DisplayName         string              `yaml:"display_name" json:"displayName" mapstructure:"display_name"`
	Provider            string              `yaml:"provider" json:"provider" mapstructure:"provider"` // google, github, generic
	Protocol            string              `yaml:"protocol" json:"protocol" mapstructure:"protocol"` // oidc or oauth
	IconURL             string              `yaml:"icon_url" json:"iconUrl" mapstructure:"icon_url"`
	RequiredLoginGroups []string            `yaml:"required_login_groups" json:"requiredLoginGroups" mapstructure:"required_login_groups"`
	RequiredAdminGroups []string            `yaml:"required_admin_groups" json:"requiredAdminGroups" mapstructure:"required_admin_groups"`
	ClientID            string              `yaml:"client_id" json:"clientId" mapstructure:"client_id"`
	ClientSecret        string              `yaml:"client_secret" json:"clientSecret" mapstructure:"client_secret"`
	IssuerURL           string              `yaml:"issuer_url" json:"issuerUrl" mapstructure:"issuer_url"`
	AuthURL             string              `yaml:"auth_url" json:"authUrl" mapstructure:"auth_url"`
	TokenURL            string              `yaml:"token_url" json:"tokenUrl" mapstructure:"token_url"`
	UserInfoURL         string              `yaml:"user_info_url" json:"userInfoUrl" mapstructure:"user_info_url"`
	EmailURL            string              `yaml:"email_url" json:"emailUrl" mapstructure:"email_url"`
	Scopes              []string            `yaml:"scopes" json:"scopes" mapstructure:"scopes"`
	Enabled             bool                `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	GroupMapping        map[string][]string `yaml:"group_mapping" json:"groupMapping" mapstructure:"group_mapping"`
}

type SupportedEmailProviders added in v0.6.0

type SupportedEmailProviders struct {
	SMTP *SMTPConfig `yaml:"smtp" json:"smtp" mapstructure:"smtp"`
	SES  *SESConfig  `yaml:"ses" json:"ses" mapstructure:"ses"`
}

Jump to

Keyboard shortcuts

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