spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.95k stars 1.29k forks source link

Yml key cannot contain dot #935

Closed GrapeBaBa closed 6 years ago

GrapeBaBa commented 6 years ago

I have a yml file which contain dot in yml key below, it will understand dot as a separator. Any approach could I use to escape dot?

    # Required. list of peers from participating orgs
    peers:
      peer0.hlc.com:
        # [Optional]. will this peer be sent transaction proposals for endorsement? The peer must
        # have the chaincode installed. The app can also use this property to decide which peers
        # to send the chaincode install request. Default: true
        endorsingPeer: true

        # [Optional]. will this peer be sent query proposals? The peer must have the chaincode
        # installed. The app can also use this property to decide which peers to send the
        # chaincode install request. Default: true
        chaincodeQuery: true

        # [Optional]. will this peer be sent query proposals that do not require chaincodes, like
        # queryBlock(), queryTransaction(), etc. Default: true
        ledgerQuery: true

        # [Optional]. will this peer be the target of the SDK's listener registration? All peers can
        # produce events but the app typically only needs to connect to one to listen to events.
        # Default: true
        eventSource: true

When request http://localhost:8888/master/xx-xx.yml it will show like that

peers:
      peer0:
            hlc:
              com:
spencergibb commented 6 years ago

You are using the yml endpoint correct? What are you trying to do? Just serve the raw file?

GrapeBaBa commented 6 years ago

@spencergibb I think yaml endpoint correct. Yeah, not only raw file but also read key directly. But I am using a nodejs client. Both will get wrong key which I don't expect

dsyer commented 6 years ago

Try the plain text endpoint e.g. http://localhost:8888/{app}/{profile}/{label}/filename.yml. The environment endpoint is for Spring Boot clients.

raviverel commented 5 years ago

this is happen to me also , any news about it ? com.leadspace: DEBUG turn to loggers: com: leadspace: DEBUG

ryanjbaxter commented 5 years ago

See the suggestion in the issue

raviverel commented 5 years ago

but i dont want the raw file....why this is not support ?

dsyer commented 5 years ago

Why do you care? What does your client do with the YAML? If it is a Spring Boot config file then if works already I think.

raviverel commented 5 years ago

no we are pulling it in our deployment , we dont use spring boot

dsyer commented 5 years ago

If you don't use Spring Boot then really the plain text endpoint is the only one that makes sense isn't it? What stops you from using that?

raviverel commented 5 years ago

we are using the inherit functionality , it help us to write simple config ( got alot of env with common config )

dsyer commented 5 years ago

OK, well then you can't use periods in field names I guess, unless you escape them maybe (did you try quoting the keys?).

raviverel commented 5 years ago

yes.. tried this: "[bar.com]":

by doc its suppose to work: https://stackoverflow.com/questions/34070987/escaping-a-dot-in-a-map-key-in-yaml-in-spring-boot but it is not..

i think its a bug..

dsyer commented 5 years ago

Not really a bug. It was never designed to work that way.

raviverel commented 5 years ago

any chance it will be done ?

dsyer commented 5 years ago

I don't think it's possible. Have a look if you want and send a PR if you find a way.