Documentation ¶
Index ¶
Constants ¶
View Source
const Version = "development"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // DB contains database connection config. DB DB `json:"db"` // SocketFile contains path to socket. SocketFile string `json:"socket_file"` // Server contains API server config. Server *Server `json:"server"` // Security contains security config. Security *Security `json:"security"` // LogLevel contains level of logging. // // You can use following values: // * debug // * info (default) // * warn // * error // * off LogLevel LogLevel `json:"log_level,omitempty"` }
Config stores configuration for GoQuiz.
func LoadFromFile ¶
LoadFromFile loads configuration from json file.
type DB ¶
type DB struct { // Options contains options for database driver. // // For SQLiteDriver field should contains SQLiteOptions. // For PostgresDriver field should contains PostgresOptions. Options any }
DB stores configuration for database connection.
func (DB) MarshalJSON ¶
func (*DB) UnmarshalJSON ¶
UnmarshalJSON parses JSON to create appropriate connection configuration.
type PostgresOptions ¶
type PostgresOptions struct { // Hosts contains hosts addresses. Hosts []string `json:"hosts"` // Port contains port address. Port int `json:"port"` // User contains username of user. User string `json:"user"` // Password contains password of user. Password string `json:"password"` // Name contains name of database. Name string `json:"name"` // SSLMode contains sslmode configuration. SSLMode string `json:"sslmode"` }
PostgresOptions stores Postgres connection options.
type SQLiteOptions ¶
type SQLiteOptions struct { // Path contains path to SQLite database file. Path string `json:"path"` }
SQLiteOptions stores SQLite connection options.
type Security ¶
type Security struct { // PasswordSalt contains salt for password hashing. PasswordSalt string `json:"password_salt"` }
Security contains security config.
Click to show internal directories.
Click to hide internal directories.