增加saastool功能
This commit is contained in:
30
cmd/saastool/config.go
Normal file
30
cmd/saastool/config.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
// Config 配置
|
||||
type Config struct {
|
||||
Auth Auth
|
||||
ApiUrls ApiUrls
|
||||
}
|
||||
|
||||
// DB 配置
|
||||
type Auth struct {
|
||||
Account string
|
||||
Token string
|
||||
}
|
||||
|
||||
type ApiUrls struct {
|
||||
UrlBase string
|
||||
Write string
|
||||
Read string
|
||||
}
|
||||
|
||||
// LoadConfigFile 加载配置文件
|
||||
func LoadConfigFile(filename string) (*Config, error) {
|
||||
sc := &Config{}
|
||||
_, err := toml.DecodeFile(filename, sc)
|
||||
return sc, err
|
||||
}
|
||||
Reference in New Issue
Block a user