-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document howto share common properties for a subset of services #618
Comments
Use profiles? At the very least We use the boot mechanisms to load these files, so we don't want to stray from that. |
The only special file in configserver is |
You could set, on the client side, That looks like it will work. |
That's very good to know. I will test this and confirm the results soon. Thank you @spencergibb |
Might be nice to add to the docs. |
@spencergibb It is working as you described. Thank you very much! One thing I noticed is that the order of the names defined under spring.cloud.config.name matters. That is, if spring.application.name=cassandra,servicea then properties in servicea.properties file override any matching properties in cassandra.properties |
Noted on ordering. That is because that is how the properties are ordered coming back from config server, so it does make sense to me. |
We have several micro-services in our project that use the same config server (same git repository). Any common properties that are needed by more than one service/module are being placed in application.properties. So if serviceA and serviceB need a property, it will be placed in application.properties. But the problem is that this property will be available to rest of the services as well. This makes it harder for the dev ops team to configure the application.properties as they need to understand which specific properties apply to a particular service. For better manageability, we would also like to store these properties in separate files and have services load them up via config server.
So my questions are:
Is there any way we can share a common set of properties among a subset of services (and not all of them) without polluting the base application.properties? Is it possible to define multiple base files for a service? For example,
I would like to have multiple base property files like below:
application.properties
application-prod.properties
cassandra.properties
cassandra-prod.properties
jpa.properties
jpa-prod.properties
redis.properties
redis-prod.properties
async.properties
async-prod.properties
And configure a service to use just the property files that it needs. So serviceA and serviceB which use cassandra can be configured to use application.properties and cassandra.properties whereas ServiceC which needs jpa will be configured to use application.properties and jpa.properties
Please let me know if something like above is possible and if there are any approaches that might help in our case. Thanks in advance for any help/suggestions you can provide
The text was updated successfully, but these errors were encountered: