keycloak-config-cli icon indicating copy to clipboard operation
keycloak-config-cli copied to clipboard

Possibility to "spread" env variables to a json array?

Open manuschillerdev opened this issue 2 years ago • 2 comments

Problem Statement

I want to provide redirectURIs for client apps via env variables.

Minimal Example:

{
  "realm": "example",
  "clients": [
    {
      "clientId": "webapp",
      "name": "webapp",
      "redirectUris": ["/*"] // can this be something like $(env:CLIENT_WEBAPP_REDIRECT_URIS)?
      // suppose CLIENT_WEBAPP_REDIRECT_URIS="https://host1.tld,https://host2.tld,https://host3.tld"
      // should be turned into:
      "redirectUris": ["https://host1.tld", "https://host2.tld", "https://host3.tld"]
    }
  ]
}

### Proposed Solution

I am not sure how a proper solution would look like.
There are several helpers like `urlDecoder`. Maybe a solution would be to have something like `toArrray`?
But since `keycloak-config-cli` uses [Apache StringSubstitutor](https://commons.apache.org/proper/commons-text/apidocs/org/apache/commons/text/StringSubstitutor.html) I am not sure, if that would be feasible at all.

### Environment

- Keycloak Version: 21.1.1-debian-11-r8
- keycloak-config-cli Version: 5.6.1-debian-11-r22
- Java Version: I guess 11?


### Additional information

_No response_

### Acceptance Criteria

- [ ] As a user, I can define env variables as comma separated lists, that get expanded to array values in Keycloak JSON Configurations

manuschillerdev avatar May 24 '23 06:05 manuschillerdev