config

package
v0.0.0-...-be230c0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMinimumBouts

func DefaultMinimumBouts() int

DefaultMinimumBouts returns an int representing the minimum number of bouts in the current season in which a fencer must pariticipate in order to be considered "eligible" for the championships and count for seeding purposes.

func DefaultSeasonStartDateConfig

func DefaultSeasonStartDateConfig() time.Time

DefaultSeasonStartDateConfig returns a time.Time representing a default start date for the current season based on the date August 1 in the most recent year in which that date has already occurred.

func SeasonStartDateConfig

func SeasonStartDateConfig(month time.Month, day int) time.Time

SeasonStartDateConfig returns a time.Time representing the start date of the current season using parameters month and day and the most recent year in which that date has already occured.

Types

type Config

type Config struct {
	Host            string         `json:"domain"`
	Port            int            `json:"port"`
	Env             string         `json:"env"`
	Pepper          string         `json:"pepper"`
	HMACKey         string         `json:"hmac_key"`
	Database        PostgresConfig `json:"database"`
	Mailgun         MailgunConfig  `json:"mailgun"`
	SeasonStartDate time.Time      `json:"season_start_date"`
	MinimumBouts    int            `json:"minimum_bouts"`
}

Config defines the app configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default app config.

func LoadConfig

func LoadConfig(configReq bool) Config

LoadConfig returns a Config based on the configuration specified in the config.json file, or the DefaultConfig if no config.json does not exist.

func (Config) BaseUrl

func (c Config) BaseUrl() string

func (Config) IsProd

func (c Config) IsProd() bool

IsProd returns true if the app is in production, and false otherwise.

type MailgunConfig

type MailgunConfig struct {
	From   string `json:"from"`
	APIKey string `json:"api_key"`
	Domain string `json:"domain"`
}

func DefaultMailgunConfig

func DefaultMailgunConfig() MailgunConfig

DefaultMailgunConfig returns a default mailgun config for use in development.

type PostgresConfig

type PostgresConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	Name     string `json:"name"`
}

PostgresConfig is used to configure postgres to connect to the database.

func DefaultPostgresConfig

func DefaultPostgresConfig() PostgresConfig

DefaultPostgresConfig returns a default postgres config for use in development.

func (PostgresConfig) ConnectionInfo

func (c PostgresConfig) ConnectionInfo() string

ConnectionInfo returns the postgres connection info for use to connect to the database.

func (PostgresConfig) Dialect

func (c PostgresConfig) Dialect() string

Dialect returns the dialect of the database used.

Jump to

Keyboard shortcuts

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