conf

package
v1.0.0-beta.29 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureTracing

func ConfigureTracing(tc *TracingConfig)

func ConfigureZeroLogging

func ConfigureZeroLogging(config *LoggingConfig)

Types

type Configuration

type Configuration struct {
	SiteURL          string                `json:"site_url" split_words:"true" required:"true"`
	TigrisWebsiteURL string                `json:"tigris_website_url" split_words:"true" required:"false"`
	TigrisConsoleURL string                `json:"tigris_console_url" split_words:"true" required:"false"`
	JWT              JWTConfiguration      `json:"jwt"`
	SMTP             SMTPConfiguration     `json:"smtp"`
	Mailer           MailerConfiguration   `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 CustomerIOConfiguration

type CustomerIOConfiguration struct {
	ApiKey                   string `json:"api_key"  split_words:"true" `
	UserInvitationTemplateId string `json:"user_invitation_template_id" split_words:"true"`
}

type DBConfiguration

type DBConfiguration struct {
	URL           string `json:"url" envconfig:"GOTRUE_DB_URL" required:"true"`
	Namespace     string `json:"namespace"`
	Project       string `json:"project" required:"true"`
	Branch        string `json:"db_branch" envconfig:"GOTRUE_DB_BRANCH" required:"true"`
	Token         string `json:"token" envconfig:"GOTRUE_DB_TOKEN"`
	ClientId      string `json:"client_id" envconfig:"GOTRUE_DB_CLIENT_ID"`
	ClientSecret  string `json:"client_secret" envconfig:"GOTRUE_DB_CLIENT_SECRET"`
	EncryptionKey string `json:"encryption_key" envconfig:"GOTRUE_DB_ENCRYPTION_KEY"`
}

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"`
		EnableDebugEndpoint bool   `envconfig:"ENABLE_DEBUG_ENDPOINT"`
		TokenCacheSize      int    `envconfig:"TOKEN_CACHE_SIZE" default:"100"`
		EnableTokenCache    bool   `envconfig:"ENABLE_TOKEN_CACHE" default:"false"`
	}
	DB                DBConfiguration
	External          ProviderConfiguration
	Logging           LoggingConfig `envconfig:"LOG"`
	OperatorToken     string        `split_words:"true" required:"true"`
	MultiInstanceMode bool
	Tracing           TracingConfig
	SMTP              SMTPConfiguration

	RateLimitHeader  string                  `split_words:"true"`
	InvitationConfig InvitationConfiguration `envconfig:"invitation"`
}

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 InvitationConfiguration

type InvitationConfiguration struct {
	CodeLength int `json:"code_length" default:"30"`
	// allows the delay of leeway seconds in expiration of the invitation code
	LeewaySecond int    `json:"leeway_second" default:"300"`
	CodePrefix   string `json:"code_prefix" default:"ti_"`
	HideCode     bool   `json:"hide_code" default:"false"`
}

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"`
	Algorithm        string `json:"algorithm"`
	Issuer           string `json:"issuer"`
	// Current RSA private key used to sign the token currently
	RSAPrivateKey string `json:"rsa_private_key" split_words:"true"`
	// Current and past few RSA public keys used to sign the token.
	// First entry points to current public key
	RSAPublicKeys []string `json:"rsa_public_keys" split_words:"true"`
}

JWTConfiguration holds all the JWT related configuration.

type LoggingConfig

type LoggingConfig struct {
	Level            string                 `mapstructure:"log_level" json:"log_level"  default:"DEBUG"`
	File             string                 `mapstructure:"log_file" json:"log_file"`
	DisableColors    bool                   `mapstructure:"disable_colors" split_words:"true" json:"disable_colors"`
	QuoteEmptyFields bool                   `mapstructure:"quote_empty_fields" split_words:"true" json:"quote_empty_fields"`
	TSFormat         string                 `mapstructure:"ts_format" json:"ts_format"`
	Fields           map[string]interface{} `mapstructure:"fields" json:"fields"`
	Format           string                 `mapstructure:"format" json:"format" default:"console"` // defaults to std log - developer friendly
}

type MailerConfiguration

type MailerConfiguration struct {
	Autoconfirm bool                      `json:"autoconfirm"`
	Subjects    EmailContentConfiguration `json:"subjects"`
	Templates   EmailContentConfiguration `json:"templates"`
	URLPaths    EmailContentConfiguration `json:"url_paths"`
	Type        string                    `json:"type"`
	CustomerIO  CustomerIOConfiguration   `json:"customerio"`
}

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,omitempty" default:"587"`
	User         string        `json:"user"`
	Pass         string        `json:"pass,omitempty"`
	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 TracingConfig

type TracingConfig struct {
	Enabled     bool `default:"false"`
	Host        string
	Port        string
	ServiceName string `default:"gotrue" split_words:"true"`
	Tags        map[string]string
}

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