Documentation ¶
Index ¶
Constants ¶
View Source
const (
// AppName app name
AppName = "url-shortener"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ServiceName logging service name ServiceName string `toml:"service_name" validate:"required"` // Environment development, staging, production Environment string `toml:"environment" validate:"required"` // HTTPAddr internal server http address HTTPAddr string `toml:"http_addr" validate:"required"` // LogLevel ... LogLevel string `toml:"log_level" validate:"required"` // EnableApplicationProfiler ... EnableApplicationProfiler bool `toml:"enable_application_profiler"` // Coordination ... Coordination Coordination `toml:"coordination" validate:"required,dive"` // MySqlDB application DB config AppDB MySqlDB `toml:"app_db" validate:"required,dive"` // contains filtered or unexported fields }
Config is app config
func LoadFromPath ¶
LoadFromPath loads configurations commitHash is a git commit hash of this app build tag is a git tag of this app build
func (*Config) CommitHash ¶
CommitHash returns git commit hash of this app build
func (*Config) GetUserAgent ¶
GetUserAgent creates user-agent string for remote calls
type Coordination ¶
type Coordination struct { // NodeID represents the unique identifier for the application, which must maintain its uniqueness within the cluster. NodeID string `toml:"node_id" validation:"required"` // RangeSize range size to be reserved in each request RangeSize int `toml:"range_size" validation:"required"` // DataStore MySql datastore that is being used for coordination purposes DataStore MySqlDB `toml:"datastore" validate:"required,dive"` }
type DBCredential ¶
type DBCredential struct { // Host ... Host string `toml:"host" validate:"required"` // DBName ... DBName string `toml:"db_name" validate:"required"` // Username ... Username string `toml:"username" validate:"required"` // Password ... Password string `toml:"password" validate:"required"` }
DBCredential database credential
type MySqlDB ¶
type MySqlDB struct { // Credentials ... Credential DBCredential `toml:"credential" validate:"required"` // Toml config constraint https://github.com/toml-lang/toml/issues/514 // ReadTimeoutSec ... ReadTimeoutSec int `toml:"read_timeout_sec" validate:"required"` // WriteTimeoutSec ... WriteTimeoutSec int `toml:"write_timeout_sec" validate:"required"` // MaxOpenConn ... MaxOpenConn int `toml:"max_open_conn" validate:"required"` // ConnLifetimeSec ... ConnLifetimeSec int `toml:"connection_lifetime_sec" validate:"required"` }
MySqlDB contains mysql db configs
Click to show internal directories.
Click to hide internal directories.