Open benr77 opened 2 years ago
Hello, Symfony uses a compiler pass (ResolveParameterPlaceHoldersPass()) for parsing parameters placeholders and replace them with actual values. As far I know, Bolt Forms doesn't store his configurations in Symfony's container at all. It's YAML parser is a simple service, injected in every place the configuration is needed, and the YAML files are parsed on demand. Conclusion : no use of container = no compiler pass = no placeholders params replacement.
Thanks for your reply. I can see what you are referring to.
This does seem rather strange to me, as Bolt is based on Symfony, and yet has rolled it's own configuration reading instead of just using the default Symfony config system.
As a consequence, I have to hard-code API keys into files instead of using environment variables or even the Symfony Secrets system.
Bolt Forms could be a Symfony bundle, and have a standard bundle configuration file. I don't know the reasoning behind why this is not the case, but I'm guessing @bobdenotter will be able to shed some light on this.
I encounter the same problem as you : I have 4 forms with ReCaptcha, and I have to centralize Google keys. I've not tested it yet, but there is a possible solution :
.env.local
or the server environment varsservice.yaml
, define a couple of parameters based on two previous var params@boltforms/form.twig
, use the configuration overrides capabilities of boltforms()
Twig function, to pass the keys to the ReCaptcha fields, since Twig has access to the params container.Aha that looks interesting (the config overrides) - thanks. I'll give that a try when I'm next back on that project.
Bolt Forms 1.4.17
I'm using the reCaptcha v3 field type and need to specify the Google API keys. Currently it seems that you cannot use any Symfony configuration parameters or environment variables in this config file, like you can with Symfony YAML configuration, so I'm forced to hard-code the API keys, meaning they get stored in the Git repo and are visible to all.
Is this a known limitation?
Thanks