These are chat archives for spring-cloud/spring-cloud

30th
May 2016
Tommy Ludwig
@shakuzen
May 30 2016 06:03

Spring Cloud Config question: I would like to serve plain text files from the config server for arbitrary applications, but use that application's name (as determined from the request URL) as part of a variable/placeholder. That is, the application itself has no properties/yml files in the config repository because it only needs plain text files. Otherwise I would just set spring.application.name in that app's yaml file, but then I need to have such a file just to set the application name for each app that wants to get such a plain text file.

I thought I would be able to do this already, but I'm not seeing a way. Is there a variable/placeholder I can use to refer to the {name} in the URL /{name}/{profile}/{label}/{path}?

szisti
@szisti
May 30 2016 06:07
I'm not sure I completely understand your question but the default application name is application if you want plain text files depending on your search path settings it can work without setting the name
/application/default/master/text file.txt
Tommy Ludwig
@shakuzen
May 30 2016 06:08
So if I request with /app1/dev/master/hi.txt I want it to serve a plain text file that has say Hi {name}! and it will resolve to Hi app1! But when I request with /app2/dev/master/hi.txt it will respond with Hi app2!
Does that make more sense?
szisti
@szisti
May 30 2016 06:11
You should try {application} with and without the $ sign
I'm not sure if it would work or not but you can test it in 5 minutes
Tommy Ludwig
@shakuzen
May 30 2016 06:12
Yes, I have tested that and it is not working
szisti
@szisti
May 30 2016 06:13
In that case probably the plain text means plain text ..
Tommy Ludwig
@shakuzen
May 30 2016 06:14
As the documentation states, you can resolve variables no problem. I know that is working. As I said, if I have an app with ${spring.application.name} defined in the config repo, I can use that variable in the plain text file no problem.
Dieter Hubau
@Turbots
May 30 2016 06:43
what is the usecase for this @shakuzen ?How would a textfile help you more than going to the actual config REST endpoint?
Tommy Ludwig
@shakuzen
May 30 2016 06:47
What do you mean by the actual config REST endpoint? The use case is to retrieve a configuration file that is not in YAML or Properties file format, to be used by arbitrary applications that otherwise are not clients of the config server - which is one of the main use cases of the serving plain files feature of the config server, I assume. My twist is wanting to use the name of the application part.
So, not my actual use case, but perhaps you want to retrieve a logback.xml file and in it use the application name (let's say "myapi"). But the application doesn't have other configuration in the config server - no myapi.yml file, etc.
szisti
@szisti
May 30 2016 07:12
But you could replace the place holder of your choice in the client
As the information is available for you there
Dieter Hubau
@Turbots
May 30 2016 07:18
and I dont understand how the config server is supposed to know which application you’re referring to, if you dont have an application name property defined
Tommy Ludwig
@shakuzen
May 30 2016 07:20
From the request URL. The request is in the format /{name}/{profile}/{label}/{path}. The "name" there is the application name. Placeholders that refer to that can be used in properties like searchPaths already.
Dieter Hubau
@Turbots
May 30 2016 07:31
ok, so the applications themselves have their application.name defined,
Tommy Ludwig
@shakuzen
May 30 2016 07:32
Yes, locally the application knows its name. I guess I'll just open an enhancement request with the full details and see what the team thinks.
Dieter Hubau
@Turbots
May 30 2016 07:38

Otherwise I would just set spring.application.name in that app's yaml file, but then I need to have such a file just to set the application name for each app that wants to get such a plain text file

OK because from this above sentence I didnt get how it would know your application :smile:
I’m sure if you explain it correctly in the request and it has value for others as well, it will get picked up :+1:

dragontree101
@dragontree101
May 30 2016 08:20
spring cloud question: i found spring cloud consul and spring cloud zookeeper always update,but spring cloud etcd have not update serval month, i want to use etcd to do service discovery, could i use spring-cloud-etcd this project? thanks
szisti
@szisti
May 30 2016 12:44
is it possible to disable the configServer health check in the client ? i've tried management.health.configServer.enabled=false but it does not work, and cannot find anything in the code either (ConfigServerHealthIndicator)
Tommy Ludwig
@shakuzen
May 30 2016 12:48
Try spring.cloud.config.health.enabled=false
It should probably be added to the documentation explicitly, but looks like it was added in spring-cloud/spring-cloud-config#159
szisti
@szisti
May 30 2016 13:08
thank you, the current one is health.config.enabled (found it in the issue you sent me)
Spencer Gibb
@spencergibb
May 30 2016 14:44
@dragontree101 etcd is not currently supported, it's an incubator project.