Documentation ¶
Overview ¶
Package app contains the app server.
Index ¶
- func AuthConfig(globalConfig *viper.Viper) *viper.Viper
- func DBConfig(globalConfig *viper.Viper) (config *mysql.Config, err error)
- func DomainsConfig(globalConfig *viper.Viper) (config []domain.ConfigItem, err error)
- func LoadConfig() *viper.Viper
- func LoggingConfig(globalConfig *viper.Viper) *viper.Viper
- func ServerConfig(globalConfig *viper.Viper) *viper.Viper
- func TokenConfig(globalConfig *viper.Viper) (*token.Config, error)
- type Application
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthConfig ¶
AuthConfig returns an auth dynamic config from the global config (env var changes impacts values)
func DomainsConfig ¶
func DomainsConfig(globalConfig *viper.Viper) (config []domain.ConfigItem, err error)
DomainsConfig returns the domains fixed config from the global config Panic in case of marshaling error.
func LoadConfig ¶
LoadConfig loads and return the global configuration from files, flags, env, ... The precedence of config values in viper is the following: 1) explicit call to Set 2) flag (i.e., settable by command line) 3) env 4) config file 5) key/value store 6) default
func LoggingConfig ¶
LoggingConfig returns a logging dynamic config from the global config (env var changes impacts values)
func ServerConfig ¶
ServerConfig returns a logging dynamic config from the global config (env var changes impacts values)
Types ¶
type Application ¶
type Application struct { HTTPHandler *chi.Mux Config *viper.Viper Database *database.DB // contains filtered or unexported fields }
Application is the core state of the app
func (*Application) CheckConfig ¶
func (app *Application) CheckConfig() error
CheckConfig checks that the database contains all the data needed by the config
func (*Application) CreateMissingData ¶
func (app *Application) CreateMissingData() error
CreateMissingData fills the database with required data (if missing)
func (*Application) ReplaceAuthConfig ¶
func (app *Application) ReplaceAuthConfig(newGlobalConfig *viper.Viper)
ReplaceAuthConfig replaces the auth part of the config by the given one.
func (*Application) ReplaceDomainsConfig ¶
func (app *Application) ReplaceDomainsConfig(newGlobalConfig *viper.Viper)
ReplaceDomainsConfig replaces the domains part of the config by the given one.
Directories ¶
Path | Synopsis |
---|---|
Package api contains the web services API.
|
Package api contains the web services API. |
answers
Package answers provides API services for task answers managing.
|
Package answers provides API services for task answers managing. |
auth
Package auth provides API services related to authentication.
|
Package auth provides API services related to authentication. |
contests
Package contests provides API services for contests managing.
|
Package contests provides API services for contests managing. |
currentuser
Package currentuser provides the services related to the current user.
|
Package currentuser provides the services related to the current user. |
groups
Package groups provides API services to manage groups.
|
Package groups provides API services to manage groups. |
items
Package items provides API services for items managing.
|
Package items provides API services for items managing. |
threads
Package threads provides API services for threads managing.
|
Package threads provides API services for threads managing. |
users
Package users provides API services for users managing.
|
Package users provides API services for users managing. |
Package appenv provides utilities to configure the app environment (prod, dev, test).
|
Package appenv provides utilities to configure the app environment (prod, dev, test). |
Package auth provides user authentication.
|
Package auth provides user authentication. |
Package database provides an interface for database operations.
|
Package database provides an interface for database operations. |
mysqldb
Package mysqldb contains database-related functions that are specific to mysql.
|
Package mysqldb contains database-related functions that are specific to mysql. |
Package doc provides data structures definitions used by swagger to generate documentation.
|
Package doc provides data structures definitions used by swagger to generate documentation. |
Package domain provides domain-specific configuration.
|
Package domain provides domain-specific configuration. |
Package formdata provides an interface to handle forms.
|
Package formdata provides an interface to handle forms. |
Package logging provides utilities for logging.
|
Package logging provides utilities for logging. |
Package loggingtest provides functions to test the content of the logs.
|
Package loggingtest provides functions to test the content of the logs. |
Package loginmodule provides functions related to user login.
|
Package loginmodule provides functions related to user login. |
Package payloads defines data structures to be used as tokens.
|
Package payloads defines data structures to be used as tokens. |
Package payloadstest contains token payloads to be used for tests.
|
Package payloadstest contains token payloads to be used for tests. |
Package rand provides utilities to generate random data.
|
Package rand provides utilities to generate random data. |
Package service provides utilities used for implementing services.
|
Package service provides utilities used for implementing services. |
Package servicetest provides utilities to test services.
|
Package servicetest provides utilities to test services. |
Package structures provides item-related structs.
|
Package structures provides item-related structs. |
Package token provides a way to serialize/un-serialize data structures in an encrypted token.
|
Package token provides a way to serialize/un-serialize data structures in an encrypted token. |
Package tokentest provides cryptographic keys to be used for tests.
|
Package tokentest provides cryptographic keys to be used for tests. |