// Package config ----------------------------- // @file : bos.go // @author : JJXu // @contact : wavingbear@163.com // @time : 2023/10/19 10:50 // ------------------------------------------- package config import ( "fmt" "gopkg.in/ini.v1" "log" ) var Bos = bosConfig{} type bosConfig struct { AK string `ini:"Ak"` SK string `ini:"Sk"` BucketName string `ini:"BucketName"` BaseDir string `ini:"BosBaseDir"` Url string `ini:"BosUrl"` } func (b *bosConfig) SectionName() string { return "bos" } func (b *bosConfig) LoadConfig(file *ini.File) { section := file.Section(b.SectionName()) err := section.MapTo(b) if err != nil { log.Println(err.Error()) } fmt.Println("bos config:") fmt.Println("\tBosSK:", b.AK) fmt.Println("\tBosSK:", b.SK) fmt.Println("\tBosBucketName:", b.BucketName) fmt.Println("\tBosBaseDir:", b.BaseDir) fmt.Println("\tBosUrl:", b.Url) }