config

package
v0.0.0-...-7a3a1f4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedFormat

type AllowedFormat struct {
	// contains filtered or unexported fields
}

func (*AllowedFormat) Set

func (f *AllowedFormat) Set(s string) error

func (*AllowedFormat) String

func (f *AllowedFormat) String() string

type AllowedLevel

type AllowedLevel struct {
	// contains filtered or unexported fields
}

func (*AllowedLevel) GetLevelOption

func (l *AllowedLevel) GetLevelOption() level.Option

func (*AllowedLevel) Set

func (l *AllowedLevel) Set(s string) error

func (*AllowedLevel) String

func (l *AllowedLevel) String() string

type Config

type Config struct {
	Version  string
	Database *DatabaseConfig `kiper_config:"name:database"`
	Log      *LogConfig      `kiper_config:"name:log"`
	Server   *ServerConfig   `kiper_config:"name:server"`
	Register *RegisterConfig `kiper_config:"name:register"`
	Cors     *CorsConfig     `kiper_config:"name:cors"`
}

func NewConfig

func NewConfig(args []string, version string) (*Config, error)

type CorsConfig

type CorsConfig struct {
	AllowedOrigins []string `kiper_value:"name:allow_origins;help:allow origins url;default:*"`
	AllowedHeaders []string `kiper_value:"name:allow_headers;help:allow headers;default:*"`
}

type DBType

type DBType struct {
	// contains filtered or unexported fields
}

func (*DBType) Set

func (dt *DBType) Set(t string) error

func (*DBType) String

func (dt *DBType) String() string

type DatabaseConfig

type DatabaseConfig struct {
	Type         *DBType `kiper_value:"name:type;help:database type;default:mysql"`
	MaxOpenConns int     `kiper_value:"name:max_open_conns;help:max open connections of db;default:0"`
	MaxIdleConns int     `kiper_value:"name:max_idle_conns;help:max idle connections of db;default:20"`
	Host         string  `kiper_value:"name:host;help:database host;default:127.0.0.1"`
	User         string  `kiper_value:"name:user;help:database user;default:root"`
	Password     string  `kiper_value:"name:password;help:database password"`
	Port         *Port   `kiper_value:"name:port;help:database port;default:3306"`
	DB           string  `kiper_value:"name:db;help:db name"`
}

type LogConfig

type LogConfig struct {
	Level  *AllowedLevel  `kiper_value:"name:level;help:log level = debug, info, warn, error;default:info"`
	Format *AllowedFormat `kiper_value:"name:format;help:log format = json, logfmt;default:logfmt"`
	File   *string        `kiper_value:"name:file;help:log file path"`
}

type Port

type Port struct {
	// contains filtered or unexported fields
}

func (*Port) Set

func (p *Port) Set(s string) error

func (*Port) String

func (p *Port) String() string

type RegisterConfig

type RegisterConfig struct {
	Consul        bool   `kiper_value:"name:consul;help:use consul or not;default:true"`
	ConsulAddress string `kiper_value:"name:consul_address;help:consul server address;default:127.0.0.1"`
	ConsulPort    *Port  `kiper_value:"name:consul_port;help:consul server port;default:8500"`
}

type ServerConfig

type ServerConfig struct {
	Port *Port `kiper_value:"name:port;help:server listen port;default:8010"`
}

type ViewConfig

type ViewConfig struct {
	Path string `kiper_value:"name:path;help:path of html view files;default:./views"`
}

Jump to

Keyboard shortcuts

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