script

package
v1.0.2-0...-08b43f4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Schema = `` /* 791-byte string literal not displayed */

Schema 默认的配置样式

Variables

View Source
var Config = ConfigType{}

Config 程序的配置

View Source
var DefaultConfig = map[string]interface{}{
	"ADDRESS":          "0.0.0.0:5000",
	"PRIVATE_KEY_PATH": "autogen_rsa.pem",
	"PUBLIC_KEY_PATH":  "autogen_rsa_pub.pem",
	"HASH_KEY":         "secret can not guess",
	"COMPONENT_NAME":   "jwt-center",
	"LOG_LEVEL":        "DEBUG",
	"REGIST_ETCD_URLS": "",
	"REGIST_VERSION":   "",
	"REGIST_ADDRESS":   "",
}

DefaultConfig 默认配置

Functions

func Init

func Init() error

Init 初始化命令行传入的参数到配置,返回值为false表示要执行创建秘钥否则为启动服务

func InitEnvConfig

func InitEnvConfig() (map[string]interface{}, error)

InitEnvConfig 从环境变量获得的配置内容初始化配置

func InitFileConfig

func InitFileConfig() (map[string]interface{}, error)

InitFileConfig 从默认的配置文件位置读取配置

func InitFlagConfig

func InitFlagConfig() (map[string]interface{}, error)

InitFlagConfig 从命令行获取配置

func SetFileConfig

func SetFileConfig(fileName string, filePaths []string) (map[string]interface{}, error)

SetFileConfig 从指定的配置文件中读取配置

func VerifyConfig

func VerifyConfig(conf ConfigType) (bool, *gojsonschema.Result)

VerifyConfig 验证config是否符合要求

Types

type ConfigType

type ConfigType struct {
	Address        string `json:"ADDRESS"`
	PrivateKeyPath string `json:"PRIVATE_KEY_PATH"`
	PublicKeyPath  string `json:"PUBLIC_KEY_PATH"`
	Hashkey        string `json:"HASH_KEY"`
	ComponentName  string `json:"COMPONENT_NAME"`
	LogLevel       string `json:"LOG_LEVEL"`
	RegistEtcdURLS string `json:"REGIST_ETCD_URLS"`
	RegistVersion  string `json:"REGIST_VERSION"`
	RegistAddress  string `json:"REGIST_ADDRESS"`
}

ConfigType 配置类型

Jump to

Keyboard shortcuts

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