Coder Social home page Coder Social logo

Comments (2)

tianxiaoliang avatar tianxiaoliang commented on July 18, 2024

用户故事是什么,为何会需要同时支持2者,目前是2种分别支持,但是不能同时支持

from go-archaius.

moonheart avatar moonheart commented on July 18, 2024

你好, 可能我说的不太清楚, 不是同时支持两者, 是获取到的 apollo 配置没有进行解析, 还是原始的值.

apollo 配置, namespace: test, 类型: yml:

key1:
  key2:
    key3: 1

测试代码:

package main

import (
	"fmt"
	agollo "github.com/Shonminh/apollo-client"
	"github.com/go-chassis/go-archaius"
	"github.com/go-chassis/go-archaius/source/apollo"
)

func main() {
	_ = archaius.Init(archaius.WithRemoteSource(archaius.ApolloSource, &archaius.RemoteInfo{
		URL: "http://config.apollo.net",
		DefaultDimension: map[string]string{
			apollo.AppID:         "appid",
			apollo.NamespaceList: "test.yml",
		},
	}))
	raw, _ := agollo.GetConfigByKey("test.yml.content")
	fmt.Printf("%v:%v\n", "test.yml.content", raw)
	// output:
	// test.yml.content:key1:
	//   key2:
	//     key3: 1

	v, _ := agollo.GetConfigByKey("key1.key2.key3")
	fmt.Printf("%v:%v\n", "key1.key2.key3", v)
	// output:
	// key1.key2.key3:
}

代码中 agollo.GetConfigByKey("key1.key2.key3") 预期输出的值是 apollo 配置中的 1, 结果是没有获取到.

代码中 agollo.GetConfigByKey("test.yml.content") 输出的值是原始的 yml 内容, 说明并没有对 yml 进行解析.

from go-archaius.

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.