aliyun-acm是对阿里云应用配置管理的封装
package main
import (
"fmt"
"github.com/xiaojiaoyu100/aliyun-acm"
)
func Handle(config aliacm.Config) {
fmt.Println(string(config.Content))
}
func main() {
d, err := aliacm.New(
"your_addr",
"your_tenant",
"your_access_key",
"your_secret_key")
if err != nil {
return
}
var f = func(h aliacm.Unit, err error) {
fmt.Println(err)
}
d.SetHook(f)
unit := aliacm.Unit{
Group: "your_group",
DataID: "your_data_id",
FetchOnce: true, // 有且仅拉取一次
OnChange: Handle,
}
d.Add(unit)
select{}
}