Giter Site home page Giter Site logo

Comments (4)

shima-park avatar shima-park commented on May 26, 2024

通过配置项参数,设置好access_key就可以了

import (
    "github.com/shima-park/agollo"
    "github.com/shima-park/agollo/remote"
)

func main(){
    remote. SetAgolloOptions(
        agollo.WithClientOptions(agollo.WithAccessKey("your_access_key"))
    )
    remote.SetAppID("your_appid")

    v := viper.New()
    v.SetConfigType("prop")
    err := v.AddRemoteProvider("apollo", "your_apollo_endpoint", "your_apollo_namespace")
    // error handle...
    err = v.ReadRemoteConfig()
    // error handle...
}

from agollo.

lijiansgit avatar lijiansgit commented on May 26, 2024

done! thanks

from agollo.

lijiansgit avatar lijiansgit commented on May 26, 2024

测试一旦使用remote. SetAgolloOptions()之后,就获取不到值了,查看源码发现需要加上:
remote.SetAgolloOptions(agollo.AutoFetchOnCacheMiss(),......)
AutoFetchOnCacheMiss设计的目的是什么呢?那是不是需要在remote.SetAgolloOptions()函数里默认就加上呢

from agollo.

shima-park avatar shima-park commented on May 26, 2024

好奇怪,我昨天回复提交了,没看到记录了.

AutoFetchOnCacheMiss 按需配置的,自动获取没有Preload的Namespace,
算是一个懒人配置,或者在需要加载的namespace比较多,手动指定又比较烦的情况

另一种是在初始化的时候,显示的通过PreloadNamesapce("ns1", "ns2") 加载

这两个配置项在初始化时,是需要二选一去配置的,否则无法加载配置。

from agollo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.