123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package config
- import (
- "eta/eta_mini_ht_api/common/contants"
- "sync"
- )
- var (
- glOnce sync.Once
- glConfig *GLConfig
- )
- type GLOpts struct {
- DBUrl string
- }
- type GLConfig struct {
- BaseConfig
- opts GLOpts
- }
- func (r *GLConfig) GetDBUrl() string {
- return r.opts.DBUrl
- }
- func (r *GLConfig) InitConfig() {
- opts := GLOpts{
- DBUrl: r.GetString("database.url"),
- }
- r.opts = opts
- }
- func NewGLConfig() Config {
- if glConfig == nil {
- glOnce.Do(func() {
- glConfig = &GLConfig{
- BaseConfig: BaseConfig{prefix: contants.GL},
- opts: GLOpts{},
- }
- })
- }
- return glConfig
- }
- func init() {
- Register(contants.GL, NewGLConfig)
- }
|