convert comma separate string to list in yaml

739 Views Asked by At

I am using spring security and micronaut security in different projects to secure my APIs. The configuration is in YAML files as below.

application.yml

my-app:
  simple-role: user-role-id
  admin-role: manager-role-id

security:
  intercept-url-map:
    - pattern: /**
    - access:
        - ${my-app.simple-role}
        - ${my-app.admin-role}

hence the role ids are configurable.

Now the problem is, these role ids needs to be array, like this simple-role: user-role-id1,user-role-id2.

And the access fields needs to consider these roles as list, not individual elements.

So final access field should behave like

access:
  - user-role-id1
  - user-role-id2
  - manager-role-id

Is there any easy YML way?

I understand that instead of doing this in yml I can use HttpSecurity configuration and in code I can split this and set. But I am trying to find yml way.

Also because, I was not able to find HttpSecurity type of configuration in micronaut.

0

There are 0 best solutions below