Azure App Configuration - order of reading keys with different key-filters

Steve K 20 Reputation points
2024-09-03T10:40:59.8666667+00:00

Hi,

We have Java Spring applications that are integrated with Azure App Configuration.
In each application we have following setup of appconfiguration:

spring:
  cloud:
    azure:
      appconfiguration:
        stores:
          - connection-strings:
              - ...
            selects:
              - key-filter: /custom-service-prefix/
                label-filter: ""
              - key-filter: /application/
                label-filter: ""

So this reads all configurations that will start with both key filters.

Tha question is what will happen if the parameter will have duplicated entry with different prefix, e.g.

  1. Entry 1 > Key: /application/server.port, Value: 80
  2. Entry 2 > Key: /custom-service-prefix/server.port, Value: 8080

During testing we can see that the second entry value is taken, but is the order of entries somehow guaranteed? I couldn't find any documentation related to this.

Thank You.

Regards,
Stefan

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
241 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ryan Hill 29,386 Reputation points Microsoft Employee
    2024-09-04T19:42:55.6733333+00:00

    Hi @Steve K

    I followed up with the product group and the documentation could use some clarification. However, consider the following:

    spring:
      cloud:
        azure:
          appconfiguration:
            stores:
              - endpoint: "<config-2>.azconfig.io"
                selects:
                  - key-filter: "/custom/"
                    label-filter: ",dev"
                  - key-filter: "/application/"
                    label-filter: ",dev"
    
              - endpoint: "<config-1>.azconfig.io"
                selects:
                  - key-filter: "/custom/"
                    label-filter: ",dev"
                  - key-filter: "/application/"
                    label-filter: ",dev"
    

    In this setup, the configuration, config-1 will have priority, but internally the first set of key filters /custom/ will have priority. These filters will select two labels each, \0 and dev but dev keys have the priority over \0 keys.

    Considering this logic, in your configuration, /custom-service-prefix/ should have the priority. I should also note that connection-strings are considered replicas and thus treated as a single store, where the primary one is only loaded.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.