config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTemplateRootDir     = "TEMPLATES_ROOT_DIR"
	KeyTargetRootPath      = "TARGET_ROOT_PATH"
	KeyModulePrefix        = "MODULE_PREFIX"
	KeyOnceFiles           = "ONCE_FILES"
	KeyThirdPartyProtoPath = "THIRD_PARTY_PROTO_PATH"

	KeyProtoCentralRepoPath = "PROTO_CENTRAL_REPO_PATH" // Store proto files centrally in one repository
	KeyDefaultServiceGroup  = "DEFAULT_SERVICE_GROUP"

	KeyDbDSN                  = "DB_DSN"
	KeySvcGroupInitPortMap    = "SVC_GROUP_INIT_PORT_MAP"
	KeySvcPortInterval        = "SVC_PORT_INTERVAL" // Port interval between services
	KeyEnableAssignPort       = "ENABLE_ALLOC_PORT"
	KeySvcGroupInitErrcodeMap = "SVC_GROUP_INIT_ERRCODE_MAP"
	KeySvcErrcodeInterval     = "SVC_ERRCODE_INTERVAL" // Errcode range of the service
	KeyEnableAssignErrcode    = "ENABLE_ALLOC_ERRCODE"
)

Variables

View Source
var (
	DbDSN                  string
	EnableAssignPort       bool
	SvcPortInterval        int
	SvcGroupInitPortMap    map[string]interface{}
	EnableAssignErrcode    bool
	SvcErrcodeInterval     int
	SvcGroupInitErrcodeMap map[string]interface{}

	DefaultSvcGroup string
	TmplRootDir     string
	TmplConfigFile  *TemplateConfigFile

	GoModulePrefix       string
	TargetRootPath       string
	OnceFiles            []string
	ThirdPartyProtoPath  []string
	ProtoCentralRepoPath string
)

Functions

func GetHomeDir

func GetHomeDir() string

func InitGlobalVar

func InitGlobalVar() error

func PrintImportantVars

func PrintImportantVars()

func ReadYaml

func ReadYaml(fp string, conf interface{}) error

func SetDefaults

func SetDefaults()

func Validate

func Validate() error

Types

type TemplateConfigFile

type TemplateConfigFile struct {
	Target struct {
		RelativeDir struct {
			Proto  []string `yaml:"proto"`
			Client []string `yaml:"client"`
			Server []string `yaml:"server"`
		} `yaml:"relativeDir"`
	} `yaml:"target"`
	Template struct {
		FilesFormatSuffix string `yaml:"filesFormatSuffix"`
		ProtoFilename     string `yaml:"protoFilename"`
		RelativeDir       struct {
			Proto  []string `yaml:"proto"`
			Client []string `yaml:"client"`
			Server []string `yaml:"server"`
		} `yaml:"relativeDir"`
	} `yaml:"template"`
}

Jump to

Keyboard shortcuts

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