kratos
kratos copied to clipboard
Can not pass JSON to environment variable
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [ ] This issue affects my Ory Cloud project.
- [ ] I have joined the Ory Community Slack.
- [ ] I am signed up to the Ory Security Patch Newsletter.
Describe the bug
Hi! I am trying to overwrite the Kratos config file, specifically the self-service-registration-hooks-flow by providing the SELFSERVICE_FLOWS_REGISTRATION_AFTER_PASSWORD_HOOKS
environment variable, however, I only get errors when providing an array in JSON format as specified here.
Reproducing the bug
I have tried multiple versions of the env var, but neither of them works, here are all the versions I have tried (with and without quotes '
):
SELFSERVICE_FLOWS_REGISTRATION_AFTER_PASSWORD_HOOKS='[{}]'
SELFSERVICE_FLOWS_REGISTRATION_AFTER_PASSWORD_HOOKS='[]'
SELFSERVICE_FLOWS_REGISTRATION_AFTER_PASSWORD_HOOKS='[{"hook":"session"}]'
Relevant log output
No matter what I try, I always get an error similar to this:
The configuration contains values or keys which are invalid:
selfservice.flows.registration.after: map[password:map[hooks:[{"hook":"sessions"}]]]
^-- doesn't validate with "#/definitions/selfServiceAfterRegistration"
The configuration contains values or keys which are invalid:
selfservice.flows.registration.after.password: map[hooks:[{"hook":"sessions"}]]
^-- doesn't validate with "#/definitions/selfServiceAfterRegistrationMethod"
The configuration contains values or keys which are invalid:
selfservice.flows.registration.after.password.hooks: [{"hook":"sessions"}]
^-- expected array, but got string
### Relevant configuration
```yml
selfservice:
flows:
registration:
lifespan: 10m
ui_url: https://localhost:3000/register
after:
password:
hooks:
- hook: web_hook
config:
url: https://localhost:3001/create-user
method: POST
body: file:///post-registration-hook.jsonnet
Version
0.10.1
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker
Additional Context
No response
It’s not recommended to set complex config values using env vars, please use a config file instead :)
I understand, but in my case, I simply want to remove all hooks or disable them. Is there a way to remove one or multiple hooks from the config file by using environment variables? I also tried with null or undefined, but that gave a similar error :/