config

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	Enabled      bool     `split_words:"true" default:"true"`
	BindAddr     string   `split_words:"true" default:":4434"`
	Mode         string   `split_words:"true" default:"release"`
	AllowOrigins []string `split_words:"true" default:"http://localhost,http://localhost:3000,http://localhost:3001"`
	CookieDomain string   `split_words:"true"`
	Audience     string   `split_words:"true"`
	Oauth        OauthConfig

	// TokenKeys are the paths to RSA JWT signing keys in PEM encoded format. The
	// environment variable should be a comma separated list of keyid:path/to/key.pem
	// Multiple keys are used in order to rotate keys regularly; keyids therefore must
	// be sortable; in general we prefer to use ksuid for key ids.
	TokenKeys map[string]string `split_words:"true"`
}

func (AdminConfig) Validate

func (c AdminConfig) Validate() error

type BackupConfig

type BackupConfig struct {
	Enabled  bool          `split_words:"true" default:"false"`
	Interval time.Duration `split_words:"true" default:"24h"`
	Storage  string        `split_words:"true" required:"false"`
	Keep     int           `split_words:"true" default:"1"`
}

type CertManConfig

type CertManConfig struct {
	Enabled            bool          `split_words:"true" default:"true"`
	RequestInterval    time.Duration `split_words:"true" default:"10m"`
	ReissuanceInterval time.Duration `split_words:"true" default:"24h"`
	Storage            string        `split_words:"true" required:"false"`
	DirectoryID        string        `envconfig:"GDS_DIRECTORY_ID" default:"vaspdirectory.net"`
	Sectigo            sectigo.Config
}

func (CertManConfig) Validate added in v1.5.1

func (c CertManConfig) Validate() (err error)

type Config

type Config struct {
	DirectoryID string              `split_words:"true" default:"vaspdirectory.net"`
	SecretKey   string              `split_words:"true" required:"true"`
	Maintenance bool                `split_words:"true" default:"false"`
	LogLevel    logger.LevelDecoder `split_words:"true" default:"info"`
	ConsoleLog  bool                `split_words:"true" default:"false"`
	GDS         GDSConfig
	Admin       AdminConfig
	Members     MembersConfig
	Database    config.StoreConfig
	Email       EmailConfig
	CertMan     CertManConfig
	Backup      BackupConfig
	Secrets     SecretsConfig
	Sentry      sentry.Config
	// contains filtered or unexported fields
}

Config uses envconfig to load required settings from the environment and validate them in preparation for running the TRISA Global Directory Service.

func New

func New() (_ Config, err error)

New creates a new Config object, loading environment variables and defaults.

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

func (Config) Mark

func (c Config) Mark() (Config, error)

Mark a manually constructed as processed as long as it is validated.

func (Config) Validate

func (c Config) Validate() (err error)

type EmailConfig

type EmailConfig struct {
	ServiceEmail         string `envconfig:"GDS_SERVICE_EMAIL" default:"TRISA Directory Service <admin@vaspdirectory.net>"`
	AdminEmail           string `envconfig:"GDS_ADMIN_EMAIL" default:"TRISA Admins <admin@trisa.io>"`
	SendGridAPIKey       string `envconfig:"SENDGRID_API_KEY" required:"false"`
	DirectoryID          string `envconfig:"GDS_DIRECTORY_ID" default:"vaspdirectory.net"`
	VerifyContactBaseURL string `envconfig:"GDS_VERIFY_CONTACT_URL" default:"https://vaspdirectory.net/verify"`
	AdminReviewBaseURL   string `envconfig:"GDS_ADMIN_REVIEW_URL" default:"https://admin.vaspdirectory.net/vasps/"`
	Testing              bool   `split_words:"true" default:"false"`
	Storage              string `split_words:"true" default:""`
}

func (EmailConfig) Validate

func (c EmailConfig) Validate() error

type GDSConfig

type GDSConfig struct {
	Enabled  bool   `envconfig:"GDS_API_ENABLED" default:"true"`
	BindAddr string `envconfig:"GDS_BIND_ADDR" default:":4433"`
}

func (GDSConfig) Validate added in v1.5.0

func (c GDSConfig) Validate() error

type MembersConfig

type MembersConfig struct {
	Enabled  bool   `split_words:"true" default:"true"`
	BindAddr string `split_words:"true" default:":4435"`
	Insecure bool   `split_words:"true" default:"false"`
	Certs    string `split_words:"true"`
	CertPool string `split_words:"true"`
}

func (MembersConfig) Validate

func (c MembersConfig) Validate() error

type OauthConfig

type OauthConfig struct {
	GoogleAudience         string   `split_words:"true"`
	AuthorizedEmailDomains []string `split_words:"true"`
}

func (OauthConfig) Validate

func (c OauthConfig) Validate() error

type SecretsConfig

type SecretsConfig struct {
	Credentials string `envconfig:"GOOGLE_APPLICATION_CREDENTIALS" required:"false"`
	Project     string `envconfig:"GOOGLE_PROJECT_NAME" required:"false"`
	Testing     bool   `split_words:"true" default:"false"`
}

Jump to

Keyboard shortcuts

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