conf

package
v0.0.0-...-1198813 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	SiteURL string            `json:"site_url" split_words:"true" required:"true"`
	JWT     JWTConfiguration  `json:"jwt"`
	SMTP    SMTPConfiguration `json:"smtp"`
	Mailer  struct {
		Autoconfirm bool                      `json:"autoconfirm"`
		Subjects    EmailContentConfiguration `json:"subjects"`
		Templates   EmailContentConfiguration `json:"templates"`
		URLPaths    EmailContentConfiguration `json:"url_paths"`
	} `json:"mailer"`
	External      ProviderConfiguration `json:"external"`
	DisableSignup bool                  `json:"disable_signup" split_words:"true"`
	Webhook       WebhookConfig         `json:"webhook" split_words:"true"`
	Cookie        struct {
		Key      string `json:"key"`
		Duration int    `json:"duration"`
	} `json:"cookies"`
}

Configuration holds all the per-instance configuration.

func LoadConfig

func LoadConfig(filename string) (*Configuration, error)

LoadConfig loads per-instance configuration.

func (*Configuration) ApplyDefaults

func (config *Configuration) ApplyDefaults()

ApplyDefaults sets defaults for a Configuration

func (*Configuration) Scan

func (config *Configuration) Scan(src interface{}) error

func (*Configuration) Value

func (config *Configuration) Value() (driver.Value, error)

type DBConfiguration

type DBConfiguration struct {
	Driver         string `json:"driver" required:"true"`
	URL            string `json:"url" envconfig:"DATABASE_URL" required:"true"`
	Namespace      string `json:"namespace"`
	MigrationsPath string `json:"migrations_path" split_words:"true" default:"./migrations"`
}

DBConfiguration holds all the database related configuration.

type EmailContentConfiguration

type EmailContentConfiguration struct {
	Invite       string `json:"invite"`
	Confirmation string `json:"confirmation"`
	Recovery     string `json:"recovery"`
	EmailChange  string `json:"email_change" split_words:"true"`
}

EmailContentConfiguration holds the configuration for emails, both subjects and template URLs.

type EmailProviderConfiguration

type EmailProviderConfiguration struct {
	Disabled bool `json:"disabled"`
}

type GlobalConfiguration

type GlobalConfiguration struct {
	API struct {
		Host            string
		Port            int `envconfig:"PORT" default:"8081"`
		Endpoint        string
		RequestIDHeader string `envconfig:"REQUEST_ID_HEADER"`
	}
	DB                DBConfiguration
	External          ProviderConfiguration
	Logging           nconf.LoggingConfig `envconfig:"LOG"`
	OperatorToken     string              `split_words:"true" required:"true"`
	MultiInstanceMode bool
	SMTP              SMTPConfiguration
}

GlobalConfiguration holds all the configuration that applies to all instances.

func LoadGlobal

func LoadGlobal(filename string) (*GlobalConfiguration, error)

LoadGlobal loads configuration from file and environment variables.

type JWTConfiguration

type JWTConfiguration struct {
	Secret           string `json:"secret" required:"true"`
	Exp              int    `json:"exp"`
	Aud              string `json:"aud"`
	AdminGroupName   string `json:"admin_group_name" split_words:"true"`
	DefaultGroupName string `json:"default_group_name" split_words:"true"`
}

JWTConfiguration holds all the JWT related configuration.

type OAuthProviderConfiguration

type OAuthProviderConfiguration struct {
	ClientID    string `json:"client_id" split_words:"true"`
	Secret      string `json:"secret"`
	RedirectURI string `json:"redirect_uri" split_words:"true"`
	URL         string `json:"url"`
	Enabled     bool   `json:"enabled"`
}

OAuthProviderConfiguration holds all config related to external account providers.

func (*OAuthProviderConfiguration) Validate

func (o *OAuthProviderConfiguration) Validate() error

type ProviderConfiguration

type ProviderConfiguration struct {
	Bitbucket   OAuthProviderConfiguration `json:"bitbucket"`
	Github      OAuthProviderConfiguration `json:"github"`
	Gitlab      OAuthProviderConfiguration `json:"gitlab"`
	Google      OAuthProviderConfiguration `json:"google"`
	Facebook    OAuthProviderConfiguration `json:"facebook"`
	Email       EmailProviderConfiguration `json:"email"`
	Saml        SamlProviderConfiguration  `json:"saml"`
	RedirectURL string                     `json:"redirect_url"`
}

type SMTPConfiguration

type SMTPConfiguration struct {
	MaxFrequency time.Duration `json:"max_frequency" split_words:"true"`
	Host         string        `json:"host"`
	Port         int           `json:"port" default:"587"`
	User         string        `json:"user"`
	Pass         string        `json:"pass"`
	AdminEmail   string        `json:"admin_email" split_words:"true"`
}

type SamlProviderConfiguration

type SamlProviderConfiguration struct {
	Enabled     bool   `json:"enabled"`
	MetadataURL string `json:"metadata_url" envconfig:"METADATA_URL"`
	APIBase     string `json:"api_base" envconfig:"API_BASE"`
	Name        string `json:"name"`
	SigningCert string `json:"signing_cert" envconfig:"SIGNING_CERT"`
	SigningKey  string `json:"signing_key" envconfig:"SIGNING_KEY"`
}

type WebhookConfig

type WebhookConfig struct {
	URL        string   `json:"url"`
	Retries    int      `json:"retries"`
	TimeoutSec int      `json:"timeout_sec"`
	Secret     string   `json:"secret"`
	Events     []string `json:"events"`
}

func (*WebhookConfig) HasEvent

func (w *WebhookConfig) HasEvent(event string) bool

Jump to

Keyboard shortcuts

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