config

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 3 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" yaml:"site_url" split_words:"true" required:"true"`
	JWT     JWTConfiguration  `json:"jwt" yaml:"jwt"`
	Web     WebConfiguration  `yaml:"Web"`
	DB      DBConfiguration   `yaml:"DB"`
	SMTP    SMTPConfiguration `yaml:"smtp"`
	Mailer  struct {
		Subjects  EmailContentConfiguration `yaml:"subjects"`
		Templates EmailContentConfiguration `yaml:"templates"`
		URLPaths  EmailContentConfiguration `yaml:"url_paths"`
	} `yaml:"mailer"`
}

Configuration holds all the configuration that applies to the shortener application.

func LoadGlobal

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

LoadGlobal loads the configuration from file and env variables.

func (*Configuration) ApplyDefaults added in v0.0.14

func (config *Configuration) ApplyDefaults()

ApplyDefaults sets defaults for a Configuration

type DBConfiguration

type DBConfiguration struct {
	Driver   string `yaml:"Driver" required:"true"`
	URL      string `yaml:"URL" required:"true"`
	IDLength int    `yaml:"IDLength" required:"true"`
}

DBConfiguration holds information about database, database driver and connection params

type EmailContentConfiguration added in v0.0.14

type EmailContentConfiguration struct {
	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 added in v0.0.14

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

EmailProviderConfiguration holds email related configs

type JWTConfiguration added in v0.0.14

type JWTConfiguration struct {
	Secret string `json:"secret" yaml:"secret" required:"true"`
	Exp    int    `json:"exp" yaml:"exp"`
}

JWTConfiguration holds all the JWT related configuration.

type SMTPConfiguration added in v0.0.14

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"`
}

SMTPConfiguration is the SMTP config for the Mailer

type WebConfiguration

type WebConfiguration struct {
	UseTLS     bool   `json:"tls" yaml:"tls"`
	ListenAddr string `yaml:"ListenAddr`
	BaseURL    string `yaml:"BaseURL"`
	Debug      bool   `yaml:"debug"`
	Redirect   string `yaml:"404Redirect"`
}

WebConfiguration keeps information for our WebService

Jump to

Keyboard shortcuts

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