Skip to content
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

Allow variables to be used as part of a value in configuration #5320

Open
cintolas opened this issue Apr 17, 2024 · 1 comment
Open

Allow variables to be used as part of a value in configuration #5320

cintolas opened this issue Apr 17, 2024 · 1 comment
Assignees
Labels
proposal Enhancement idea or proposal

Comments

@cintolas
Copy link

Proposed change

Currently the following configuration will produce authorization errors when trying to distribute this configuration to multiple systems

cluster {
  # set the variable token
  TOKEN: abc

  authorization {
      user: user
      password: $TOKEN
  }

  # use the token variable in a field. The password is evaluated as $TOKEN instead of abc
  nats://user:$TOKEN@server.example.com:6222,
  nats://user:$TOKEN@server2.example.com:6222
}

### Proposal

Allow a way for variables to be interpolated in right hand side of strings

Use case

When distributing configuration across multiple systems via an NFS mount, it makes it easier to map configuration across variables.

Since authentication in a cluster is done in the URL, you must explicitly define the password in the URL. This also disables the ability to define authentication tokens in environment variables

Contribution

No response

@cintolas cintolas added the proposal Enhancement idea or proposal label Apr 17, 2024
@khalil-omer
Copy link

I would suggest the syntax ${TOKEN} as it is pretty common. I would be surprised if there are NATS configs in the wild that are using this syntax but expecting that to be treated as a string rather than a variable, so it doesn't really seem like a breaking change to me, but of course it is indeed one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

4 participants