12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package config
- import (
- "eta_mini_ht_api/common/contants"
- "sync"
- )
- var (
- fileOnce sync.Once
- fileConfig *FileConfig
- )
- type FileOpts struct {
- Notice string
- Disclaimer string
- PublicKey string
- }
- type FileConfig struct {
- BaseConfig
- opts FileOpts
- }
- func (f *FileConfig) GetNotice() string {
- return f.opts.Notice
- }
- func (f *FileConfig) GetPublicKey() string {
- return f.opts.PublicKey
- }
- func (f *FileConfig) GetDisclaimer() string {
- return f.opts.Disclaimer
- }
- func (f *FileConfig) InitConfig() {
- opts := FileOpts{
- Notice: f.GetString("url"),
- Disclaimer: f.GetString("driver"),
- PublicKey: f.GetString("publicKey"),
- }
- f.opts = opts
- }
- func NewFileConfig() Config {
- if dbConfig == nil {
- fileOnce.Do(func() {
- fileConfig = &FileConfig{
- BaseConfig: BaseConfig{prefix: contants.FILE},
- opts: FileOpts{},
- }
- })
- }
- return fileConfig
- }
- func init() {
- Register(contants.FILE, NewFileConfig)
- }
|