英文:
How to always load feature flags with No Label in azure app config in Java, Spring
问题
I am using azure app configurations to store my feature flags.
By default feature flags are loaded as per the current profile, set in application.yaml like:
spring.profile.active
Now, my deployment environments has seperate instances of azure app config for dev, pre and prod.
So, I want if my application is running on dev environment then it should be able to load both No Label and dev label. Like if some one has defined keys only with No label then it should also work and should be able to fetch value.
This can be worked with app config by providing:
spring.cloud.azure.appconfiguration.stores[0].selects[0].label-filter: ",${spring.profiles.active}"
but providing same with feature flags doesn't work:
spring.cloud.azure.appconfiguration.stores[0].feature-flags.label-filter:",${spring.profiles.active}"
Can any suggest the way to load No Label flag when spring.profile.active has some value.
英文:
I am using azure app configurations to store my feature flags.
By default feature flags are loaded as per the current profile, set in application.yaml like:
spring.profile.active
Now, my deployment environments has seperate instances of azure app config for dev, pre and prod.
So, I want if my application is running on dev environment then it should be able to load both No Label and dev label. Like if some one has defined keys only with No label then it should also work and should be able to fetch value.
This can be worked with app config by providing:
spring.cloud.azure.appconfiguration.stores[0].selects[0].label-filter: ",${spring.profiles.active}"
but providing same with feature flags doesn't work:
spring.cloud.azure.appconfiguration.stores[0].feature-flags.label-filter:",${spring.profiles.active}"
Can any suggest the way to load No Label flag when spring.profile.active has some value.
答案1
得分: 1
你正在使用的库版本是多少?那个配置设置看起来像是旧版本。如果您升级到最新版本:
对于Spring Framework 2
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
<version>4.8.0</version>
</dependency>
对于Spring Framework 3
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
<version>5.2.0</version>
</dependency>
最新版本支持与功能标志一样的加载方式,详见此处的最后一个表格:https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-appconfiguration-config#supported-properties
英文:
What version of your library are you using, that configuration setup looks like an old one. If you updated to the latest:
For Spring Framework 2
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
<version>4.8.0</version>
</dependency>
For Spring Framework 3
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
<version>5.2.0</version>
</dependency>
The latest versions support the same loading style for feature flags as configurations, see the last table here https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-appconfiguration-config#supported-properties
答案2
得分: 0
这可以通过以下方式实现:
spring.cloud.azure.appconfiguration.stores[0].feature-flags.selects[0].label-filter = ",${spring.profiles.active}"
英文:
This can be achieved by setting:
spring.cloud.azure.appconfiguration.stores[0].feature-flags.selects[0].label-filter = ",${spring.profiles.active}"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论