-
Notifications
You must be signed in to change notification settings - Fork 257
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
Why does LoadFromPath() function of generated .pkl.go file needs .pkl file at runtime when there is already generated .pkl.go files. #375
Comments
The generated Go code is the structure of the configuration (the schema, or template). It does not contain the values of the configuration. Those, you load at runtime (so that you can change configuration out-of-sync with your application code). |
Phil is right about the generated code only being the structure, and not the values. With that said, though, there are a couple options that you have to embed values from Pkl into your application. Embed pkl filesOne option is to use The benefit of this approach is that because Pkl happens at runtime, you can pass in external variables into the Pkl program. For example, you can pass in environment variables and use The drawback is that you still need to include the Pre-evaluate Pkl into binaryIf you really don't want to include the That approach is demonstrated here: bioball/pkl-go-examples@841315b |
Iam using pkl files for config and generated go files for it. In the process of loading config Iam using LoadFromPath() this function expects a pkl file as parameter so for this I need to have pkl executable in my system.My query is when we are already generating go file from pkl why do we need to give pkl file path again.Is there any way to load pkl files from generated code without giving path to .pkl file??
The text was updated successfully, but these errors were encountered: