configuration

package
v0.0.0-...-d725eba Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustFindAndReadConfiguration

func MustFindAndReadConfiguration()

Types

type AuthenticationConfiguration

type AuthenticationConfiguration struct {
	Email struct {
		Verify bool `yaml:"verify" default:"true"`
	} `yaml:"email"`

	JWT struct {
		Secret        string        `yaml:"secret"`
		AccessExpiry  time.Duration `yaml:"access_expiry"`
		RefreshExpiry time.Duration `yaml:"refresh_expiry"`
	} `yaml:"jwt"`
	Session struct {
		Secret  string `yaml:"secret"`
		Cookies struct {
			Secure      bool          `yaml:"secure"`
			Lifetime    time.Duration `yaml:"lifetime"`
			IdleTimeout time.Duration `yaml:"idle_timeout"`
		} `yaml:"cookies"`
	} `yaml:"session"`
	Password struct {
		MinLength int `yaml:"min_length"`
	} `yaml:"password"`
	TotalRequestsPerMinute int64 `yaml:"total_requests_per_minute"`
}

type ConfigurationSchema

type ConfigurationSchema struct {
	Server ServerConfigurationSchema `yaml:"server"`
	Worker WorkerConfigurationSchema `yaml:"worker"`
}
var Configuration *ConfigurationSchema

func ParseConfiguration

func ParseConfiguration(filename string) (*ConfigurationSchema, error)

func (*ConfigurationSchema) UnmarshalYAML

func (s *ConfigurationSchema) UnmarshalYAML(unmarshal func(interface{}) error) error

type PathsConfiguration

type PathsConfiguration struct {
	Uploads        string `yaml:"uploads"`
	Common         string `yaml:"common"`
	GeneratedFiles string `yaml:"generated_files"`
}

type RabbitMQConfiguration

type RabbitMQConfiguration struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Key      string `yaml:"key"`
}

func (*RabbitMQConfiguration) URL

func (config *RabbitMQConfiguration) URL() string

type ServerConfigurationSchema

type ServerConfigurationSchema struct {
	Version   int `json:"version"`
	Debugging struct {
		Enabled     bool   `yaml:"enabled" default:"false"`
		LoginID     int64  `yaml:"login_id"`
		LoginIsRoot bool   `yaml:"login_is_root"`
		LogLevel    string `yaml:"log_level"`
		Fixtures    string `yaml:"fixtures"`
	} `yaml:"debugging"`
	HTTP struct {
		UseHTTPS bool   `yaml:"use_https"  default:"false"`
		Port     int    `yaml:"port"  default:"2020"`
		Domain   string `yaml:"domain"  default:"localhost"`
		Timeouts struct {
			Read  time.Duration `yaml:"read"`
			Write time.Duration `yaml:"write"`
		} `yaml:"timeouts"`
		Limits struct {
			MaxHeader      bytefmt.ByteSize `yaml:"max_header"`
			MaxRequestJSON bytefmt.ByteSize `yaml:"max_request_json"`
			MaxAvatar      bytefmt.ByteSize `yaml:"max_avatar"`
			MaxSubmission  bytefmt.ByteSize `yaml:"max_submission"`
		} `yaml:"limits"`
	} `yaml:"http"`
	DistributeJobs bool                        `yaml:"distribute_jobs"`
	Authentication AuthenticationConfiguration `yaml:"authentication"`
	Cronjobs       struct {
		ZipSubmissionsIntervall time.Duration `yaml:"zip_submissions_intervall"`
	} `yaml:"cronjobs"`
	Email struct {
		Send           bool   `yaml:"send"`
		SendmailBinary string `yaml:"sendmail_binary"`
		From           string `yaml:"from"`
		ChannelSize    int    `yaml:"channel_size"`
	} `yaml:"email"`
	Services struct {
		Redis struct {
			Host     string `yaml:"host"`
			Port     int    `yaml:"port"`
			Database int    `yaml:"database"`
		} `yaml:"redis"`
		Prometheus struct {
			User     string `yaml:"user"`
			Password string `yaml:"password"`
		} `yaml:"prometheus"`
		RabbitMQ RabbitMQConfiguration `yaml:"rabbit_mq"`
		Postgres struct {
			// Connection string `yaml:"connection"`
			Host     string `yaml:"host"`
			Port     int    `yaml:"port"`
			Database string `yaml:"database"`
			User     string `yaml:"user"`
			Password string `yaml:"password"`
			Debug    bool   `yaml:"debug"`
		} `yaml:"database"`
	} `yaml:"services"`
	Paths PathsConfiguration `yaml:"paths"`
}

func (*ServerConfigurationSchema) CronjobsZipSubmissionsIntervall

func (config *ServerConfigurationSchema) CronjobsZipSubmissionsIntervall() string

func (*ServerConfigurationSchema) ExternalURL

func (config *ServerConfigurationSchema) ExternalURL() string

func (*ServerConfigurationSchema) HTTPAddr

func (config *ServerConfigurationSchema) HTTPAddr() string

func (*ServerConfigurationSchema) PostgresURL

func (config *ServerConfigurationSchema) PostgresURL() string

func (*ServerConfigurationSchema) RedisURL

func (config *ServerConfigurationSchema) RedisURL() string

func (*ServerConfigurationSchema) SendEmail

func (config *ServerConfigurationSchema) SendEmail() bool

func (*ServerConfigurationSchema) URL

func (config *ServerConfigurationSchema) URL() string

type WorkerConfigurationSchema

type WorkerConfigurationSchema struct {
	Version  int `json:"version"`
	Services struct {
		RabbitMQ RabbitMQConfiguration `yaml:"rabbit_mq"`
	} `yaml:"services"`
	Workdir string `yaml:"workdir"`
	Void    bool   `yaml:"void"`
	Docker  struct {
		MaxMemory bytefmt.ByteSize `yaml:"max_memory"`
		Timeout   time.Duration    `yaml:"timeout"`
	} `yaml:"docker"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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