diff --git a/pkg/conf/datasource/file/file.go b/pkg/conf/datasource/file/file.go index 09421020ab..e46fd2e9d2 100644 --- a/pkg/conf/datasource/file/file.go +++ b/pkg/conf/datasource/file/file.go @@ -19,6 +19,7 @@ import ( "log" "path/filepath" + "github.com/douyu/jupiter/pkg/conf" "github.com/douyu/jupiter/pkg/util/xfile" "github.com/douyu/jupiter/pkg/util/xgo" "github.com/douyu/jupiter/pkg/xlog" @@ -33,8 +34,8 @@ type fileDataSource struct { changed chan struct{} } -// NewDataSource returns new fileDataSource. -func NewDataSource(path string, watch bool) *fileDataSource { +// NewDataSource returns a file-backed configuration data source. +func NewDataSource(path string, watch bool) conf.DataSource { absolutePath, err := filepath.Abs(path) if err != nil { xlog.Jupiter().Panic("new datasource", xlog.Any("err", err)) diff --git a/pkg/conf/datasource/http/yasee.go b/pkg/conf/datasource/http/yasee.go index 2816d69574..04bc55979e 100644 --- a/pkg/conf/datasource/http/yasee.go +++ b/pkg/conf/datasource/http/yasee.go @@ -22,6 +22,7 @@ import ( "strconv" "time" + "github.com/douyu/jupiter/pkg/conf" "github.com/douyu/jupiter/pkg/util/xgo" "github.com/douyu/jupiter/pkg/xlog" "github.com/go-resty/resty/v2" @@ -52,8 +53,8 @@ type ConfigData struct { LastRevision int64 `json:"last_revision"` } -// NewDataSource ... -func NewDataSource(addr string, enableWatch bool) *yaseeDataSource { +// NewDataSource returns an HTTP-backed configuration data source. +func NewDataSource(addr string, enableWatch bool) conf.DataSource { yasee := &yaseeDataSource{ client: resty.New(), addr: addr,