config

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(file, environment, version string) error

Initialize : initialize the global configuration of the application.

Types

type APIConfiguration

type APIConfiguration struct {
	Host       string
	Port       int
	Version    string
	TimeOut    int `yaml:"time_out"` // in milliseconds
	RetryCount int `yaml:"retry_count"`
}

APIConfiguration : configuration of an API called by the server.

type AccountConfiguration

type AccountConfiguration struct {
	EmailAddressMustBeConfirmed bool `yaml:"email_address_must_be_confirmed"`
	DeleteNeverUsedAfter        uint `yaml:"delete_never_used_after"` // in days
	DeleteInactiveAfter         uint `yaml:"delete_inactive_after"`   // in months
}

AccountConfiguration : configuration of the users' account.

type Configuration

type Configuration struct {
	Environment         string
	Version             string
	SupportedLocales    []string                       // Generated by the constructor
	FallbackLocales     map[string]string              // Indexes are languages (i.e. "fr", "en", etc), the values are the locale bound to this default language (i.e. "fr-fr", "en-gb", etc). Generated by the constructor
	Locales             map[string]LocaleConfiguration `yaml:"locales"`
	DefaultLocale       string                         `yaml:"default_locale"`
	DefaultTimezone     string                         `yaml:"default_timezone"`
	LocalizationPath    string                         `yaml:"localization_path"`
	TemplatesPath       string                         `yaml:"templates_path"`
	RobotsFilePath      string                         `yaml:"robots_file_path"`
	TimezonesFilePath   string                         `yaml:"timezones_file_path"`
	APIVersion          string                         `yaml:"api_version"`
	KafkaTopicsPrefix   string                         `yaml:"kafka_topics_prefix"`
	SenderName          string                         `yaml:"sender_name"`
	SenderEmailAddress  string                         `yaml:"sender_email_address"`
	NoReplyEmailAddress string                         `yaml:"noreply_email_address"`
	Server              ServerConfiguration
	Hosts               HostConfiguration
	Database            DatabaseConfiguration
	Cookie              CookieConfiguration
	JWT                 JWTConfiguration  `yaml:"jwt"`
	SMTP                SMTPConfiguration `yaml:"smtp"`
	API                 APIConfiguration  `yaml:"api"`
	Services            map[string]ServiceConfiguration
	Facebook            FacebookConfiguration
	Google              GoogleConfiguration
	SocialNetworks      SocialMediaConfiguration       `yaml:"social_networks"`
	IPStack             IPStackConfiguration           `yaml:"ipstack"`
	ExpiredAuthTokens   ExpiredAuthTokensConfiguration `yaml:"expired_auth_tokens"`
	Sitemap             SitemapConfiguration
	Terms               TermsConfiguration
	UserNotifications   UserNotificationsConfiguration `yaml:"user_notifications"`
	Account             AccountConfiguration
	RecurringTasks      []recurring.ScheduledTask `yaml:"recurring_tasks"` // tasks executed by the workers
	RunStartUpTasks     bool                      `yaml:"run_start_up_tasks"`
}

Configuration : root configuration object.

var Main *Configuration

Main : global configuration of the application.

func NewConfiguration

func NewConfiguration() (config *Configuration)

NewConfiguration : initialize a new Configuration struct.

func (*Configuration) Initialize

func (config *Configuration) Initialize(file, environment, version string) error

Initialize : initialize a configuration from a yaml file.

func (*Configuration) IsAlphaVersion

func (config *Configuration) IsAlphaVersion() bool

IsAlphaVersion : returns true if the version is Alpha.

func (*Configuration) IsBetaVersion

func (config *Configuration) IsBetaVersion() bool

IsBetaVersion : returns true if the version is Beta.

func (*Configuration) IsDebugModeEnabled

func (config *Configuration) IsDebugModeEnabled() bool

IsDebugModeEnabled : returns true if the debug mode is enabled.

func (*Configuration) IsDevelopmentEnvironment

func (config *Configuration) IsDevelopmentEnvironment() bool

IsDevelopmentEnvironment : returns true if the environment is Development.

func (*Configuration) IsFinalVersion

func (config *Configuration) IsFinalVersion() bool

IsFinalVersion : returns true if the version is Final.

func (*Configuration) IsMongoDBDatabase

func (config *Configuration) IsMongoDBDatabase() bool

IsMongoDBDatabase : returns true if the database is MongoDB.

func (*Configuration) IsProductionEnvironment

func (config *Configuration) IsProductionEnvironment() bool

IsProductionEnvironment : returns true if the environment is Production.

func (*Configuration) IsTestEnvironment

func (config *Configuration) IsTestEnvironment() bool

IsTestEnvironment : returns true if the environment is Test.

func (*Configuration) KafkaConfiguration

func (config *Configuration) KafkaConfiguration() (ServiceConfiguration, bool)

KafkaConfiguration : returns the kafka configuration if provided.

func (*Configuration) SupportsLocale

func (config *Configuration) SupportsLocale(locale string) bool

SupportsLocale : returns true if it supports the locale.

type CookieConfiguration

type CookieConfiguration struct {
	Name     string
	Domain   string
	Path     string
	TTL      int `yaml:"ttl"`
	Secure   bool
	HTTPOnly bool `yaml:"http_only"`
}

CookieConfiguration : configuration of the cookie.

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Service  string
	Host     string
	Port     int
	Database string
	Username string
	Password string
	TimeOut  int64 `yaml:"time_out"`
}

DatabaseConfiguration : configuration of the mongo database.

type ExpiredAuthTokensConfiguration

type ExpiredAuthTokensConfiguration struct {
	FlushCacheInterval int `yaml:"flush_cache_interval"`
}

ExpiredAuthTokensConfiguration : management of the expired auth tokens.

type FacebookConfiguration

type FacebookConfiguration struct {
	Enabled    bool
	AppID      string `yaml:"app_id"`
	APIVersion string `yaml:"api_version"`
	TimeOut    int    `yaml:"time_out"` // in milliseconds
	RetryCount int    `yaml:"retry_count"`
}

FacebookConfiguration : configuration of the Facebook developer application.

type GZipConfiguration

type GZipConfiguration struct {
	Enabled bool
	Level   int
}

GZipConfiguration : configuration of the GZip.

type GoogleConfiguration

type GoogleConfiguration struct {
	Enabled    bool
	ClientID   string `yaml:"client_id"`
	APIVersion string `yaml:"api_version"`
	TimeOut    int    `yaml:"time_out"` // in milliseconds
	RetryCount int    `yaml:"retry_count"`
}

GoogleConfiguration : configuration of the Google developer application.

type HostConfiguration

type HostConfiguration struct {
	API    string `yaml:"api"`
	Web    string
	Static string
}

HostConfiguration : configuration of the hosts.

type IPStackConfiguration

type IPStackConfiguration struct {
	Host string
	Key  string
}

IPStackConfiguration : configuration of the API ipstack.com.

type JWTConfiguration

type JWTConfiguration struct {
	Secret        string
	SigningMethod string `yaml:"signing_method"`
	TTL           int64  `yaml:"ttl"`
}

JWTConfiguration : configuration of the JWT tokens.

type LocaleConfiguration

type LocaleConfiguration struct {
	DateFormat     string `yaml:"date_format"`
	TimeFormat     string `yaml:"time_format"`
	DateTimeFormat string `yaml:"date_time_format"`
	Default        bool   `yaml:"default"`
}

LocaleConfiguration : configuration of the locale.

type SMTPConfiguration

type SMTPConfiguration struct {
	Host     string
	Port     int
	Username string
	Password string
}

SMTPConfiguration : configuration of the smtp server.

type SSLConfiguration

type SSLConfiguration struct {
	Enabled  bool
	CertPath string `yaml:"cert_path"`
	KeyPath  string `yaml:"key_path"`
}

SSLConfiguration : configuration of the SSL.

type ServerConfiguration

type ServerConfiguration struct {
	Host      string
	Port      int
	GZip      GZipConfiguration `yaml:"gzip"`
	SSL       SSLConfiguration  `yaml:"ssl"`
	LogFormat string            `yaml:"log_format"`
}

ServerConfiguration : configuration of the server.

type ServiceConfiguration

type ServiceConfiguration struct {
	Host string
	Port int
}

ServiceConfiguration : configuration of a hosted service.

type SitemapConfiguration

type SitemapConfiguration struct {
	Path               string `yaml:"path"`
	Name               string `yaml:"name"`
	MaximumURLsPerPage int    `yaml:"max_urls_per_page"`
}

SitemapConfiguration : management of the sitemap files generation.

type SocialMediaConfiguration

type SocialMediaConfiguration struct {
	Facebook string
	Google   string
	Twitter  string
}

SocialMediaConfiguration : the urls to the different social network pages.

type TermsConfiguration

type TermsConfiguration struct {
	Path    string `yaml:"path"`
	Version string `yaml:"version"`
}

TermsConfiguration : configuration of the terms of use of the application.

type UserNotificationsConfiguration

type UserNotificationsConfiguration struct {
	Limit int `yaml:"limit"`
}

UserNotificationsConfiguration : configuration of the notifications received by a user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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