config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAsymmetricKeyPathsNotSet = errors.New("expected jwt_private_key_path and jwt_public_key_path to be set for all supported asymmetric algorithms")
View Source
var ErrEmailNotConfigured = errors.New("expected smtp to be set if email support is enabled")
View Source
var ErrFacebookConfig = errors.New("expected facebook_client_id, facebook_client_secret to be set if facebook provider is enabled")
View Source
var ErrGithubConfig = errors.New("expected github_client_id, github_client_secret to be set if github providder is enabled")
View Source
var ErrGoogleConfig = errors.New("expected google_client_id, google_client_secret to be set if google provider is enabled")
View Source
var ErrInvalidCustomDataSchema = errors.New("invalid custom data schema")
View Source
var ErrParsingPrivateKey = errors.New("unable to parse private key")
View Source
var ErrParsingPublicKey = errors.New("unable to parse public key")
View Source
var ErrPhoneEmailDisabled = errors.New("can't disable email and phone at the same time")
View Source
var ErrSMSNotConfigured = errors.New("expected sms to be set if phone support is enabled")
View Source
var ErrSymmetricSecretNotSet = errors.New("expected jwt_secret to be set for all symmetric algorithms")
View Source
var ErrUnableToReadTemplate = errors.New("unable to read template")
View Source
var ErrUnsupportedAlgorithm = errors.New("unsupported algorithm")

Functions

This section is empty.

Types

type Choices added in v0.2.0

type Choices []string

func (Choices) Search added in v0.2.0

func (c Choices) Search(value string) bool

type Config

type Config struct {
	AccessTokenCookieName     string           `json:"access_token_cookie_name"`
	AccessTokenCookieDomain   string           `json:"access_token_cookie_domain"`
	AdminOnlyList             bool             `json:"admin_only_list"`
	ChangeTemplate            *TemplateConfig  `json:"change_template"`
	ConfirmationTemplate      *TemplateConfig  `json:"confirmation_template"`
	DatabaseURL               string           `json:"database_url"`
	DisableEmail              bool             `json:"disable_email"`
	DisablePhone              bool             `json:"disable_phone"`
	DisableSignup             bool             `json:"disable_signup"`
	EmailRule                 Regexp           `json:"email_rule"`
	Facebook                  SocialConfig     `json:"facebook"`
	Google                    SocialConfig     `json:"google"`
	Github                    SocialConfig     `json:"github"`
	Host                      string           `json:"host"`
	InstanceURL               string           `json:"instance_url"`
	InvitationTemplate        *TemplateConfig  `json:"invitation_template"`
	JWT                       JWTConfig        `json:"jwt"`
	LockoutPolicy             LockoutPolicy    `json:"lockout_policy"`
	LoginHook                 string           `json:"login_hook"`
	LogLevel                  logrus.Level     `json:"log_level"`
	MaxConnectionPoolSize     int              `json:"max_connection_pool_size"`
	MinutesBetweenEmailChange time.Duration    `json:"minutes_between_email_change"`
	MinutesBetweenPhoneChange time.Duration    `json:"minutes_between_phone_change"`
	MinutesBetweenResend      time.Duration    `json:"minutes_between_resend"`
	PasswordHashCost          uint8            `json:"password_hash_cost"`
	PasswordRule              Regexp           `json:"password_rule"`
	PhoneRule                 Regexp           `json:"phone_rule"`
	Port                      uint16           `json:"port"`
	RecoveryTemplate          *TemplateConfig  `json:"recovery_template"`
	RefreshTokenCookieName    string           `json:"refresh_token_cookie_name"`
	RefreshTokenCookieDomain  string           `json:"refresh_token_cookie_domain"`
	SetAccessTokenCookie      bool             `json:"set_access_token_cookie"`
	SetRefreshTokenCookie     bool             `json:"set_refresh_token_cookie"`
	SiteURL                   string           `json:"site_url"`
	SMS                       *SMSConfig       `json:"sms"`
	SMTP                      *SMTPConfig      `json:"smtp"`
	SocialRedirectPage        string           `json:"social_redirect_page"`
	CustomDataSchema          map[string]Field `json:"custom_data_schema"`
	MetadataPath              *JSONPath        `json:"metadata_path"`
	AdminRoles                []string         `json:"admin_roles"`
	ReadOnlyRoles             []string         `json:"read_only_roles"`
	RolesPath                 JSONPath         `json:"roles_path"`
}

func New

func New(path string) (*Config, error)

func NewDefaultConfig added in v0.8.0

func NewDefaultConfig() *Config

type Field added in v0.2.0

type Field struct {
	Type     FieldType `json:"type"`
	Required bool      `json:"required"`
	Max      *float64  `json:"maximum"`
	Min      *float64  `json:"minimum"`
	Format   *Regexp   `json:"format"`
	Choices  *Choices  `json:"choices"`
}

func (Field) Validate added in v0.2.0

func (f Field) Validate(name string, value interface{}) error

type FieldType added in v0.2.0

type FieldType string
const (
	String  FieldType = "string"
	Integer FieldType = "integer"
	Boolean FieldType = "boolean"
	Float   FieldType = "float"
)

type JSONPath added in v0.4.0

type JSONPath struct {
	jp.Expr
}

func (*JSONPath) MarshalText added in v0.4.0

func (p *JSONPath) MarshalText() ([]byte, error)

func (*JSONPath) UnmarshalText added in v0.4.0

func (p *JSONPath) UnmarshalText(text []byte) error

type JWTConfig

type JWTConfig struct {
	Aud            string        `json:"audience"`
	Alg            string        `json:"algorithm"`
	Exp            time.Duration `json:"expiry"`
	Iss            string        `json:"issuer"`
	PrivateKeyPath string        `json:"private_key_path"`
	PublicKeyPath  string        `json:"public_key_path"`
	Secret         string        `json:"secret"`
	Type           string        `json:"-"`
	// contains filtered or unexported fields
}

func (*JWTConfig) GetDecodingKey

func (c *JWTConfig) GetDecodingKey() interface{}

func (*JWTConfig) GetSigningKey

func (c *JWTConfig) GetSigningKey() interface{}

type LockoutPolicy

type LockoutPolicy struct {
	Attempts uint8         `json:"attempts"`
	For      time.Duration `json:"for"`
}

type Regexp

type Regexp struct {
	regexp.Regexp
}

func (*Regexp) MarshalText

func (r *Regexp) MarshalText() ([]byte, error)

func (*Regexp) UnmarshalText

func (r *Regexp) UnmarshalText(text []byte) error

type SMSConfig

type SMSConfig struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Source  string            `json:"source"`
	Mapping *SMSMapping       `json:"mapping"`
	Headers map[string]string `json:"headers"`
	Extra   map[string]string `json:"extra"`
}

type SMSMapping

type SMSMapping struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
	Message     string `json:"message"`
}

type SMTPConfig

type SMTPConfig struct {
	Email    string `json:"email"`
	Host     string `json:"host"`
	Password string `json:"password"`
	Port     uint16 `json:"port"`
	Username string `json:"username"`
}

type SocialConfig

type SocialConfig struct {
	Enabled bool   `json:"enabled"`
	ID      string `json:"id"`
	Secret  string `json:"secret"`
}

type Template

type Template struct {
	*mustache.Template
}

func (*Template) MarshalText

func (t *Template) MarshalText() ([]byte, error)

func (*Template) UnmarshalText

func (t *Template) UnmarshalText(text []byte) error

type TemplateConfig

type TemplateConfig struct {
	Path    string    `json:"path"`
	Subject string    `json:"subject"`
	Email   *Template `json:"-"`
	SMS     *Template `json:"sms"`
}

Jump to

Keyboard shortcuts

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