Conversation
|
|
LucDeCaf
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Tested this on my side and it looks good, just a few small observations.
Also, don't forget to sign the CLA. :)
There was a problem hiding this comment.
I noticed that when running powersync validate and powersync pull instance in the examples/cloud/basic-cloud-pull example, I got two differently formatted errors. This is preexisting and happens because only some calls to parseYamlFile are wrapped in try { ... } catch (error) { this.styledError(...); }. I'll make a followup PR to fix this; just mentioning it here.
|
|
||
| /** | ||
| * Parses a YAML document, evaluating !env tags. | ||
| * Throws when substitution fails (missing or invalid env vars) so callers cannot |
There was a problem hiding this comment.
This description is slightly misleading since the function now throws on any YAML parsing error, not just missing env vars.
Summary
!envalready recorded a parse error that named a missing variable, butparseYamlFileignoreddoc.errorsand returned the variable name as the value.validate/deploythen treateduri: PS_DATABASE_URIas a connection string, and Cloud reportedPSYNC_S1109(protocol must be postgresql, got undefined). Parse now fails with that existing message so the missing variable is named, and--validate-only=connectionsno longer swallows the failure.The reporter reproduced the Cloud protocol error on #63. Docs and README only describe process environment variables, not
.envfiles.Decision
!envparse error (name the missing variable). Do not auto-load.env/.env.local..envthen.env.localfrom the working directory (without overriding exported variables).ensureServiceTypeMatchesonly reads_type, so it usesparseYamlDocumentPreserveTagsand does not require template!envplaceholders to be set (same idea as the docker plugin when merging snippets).Testing
parseYamlFilethrows namingPS_DATABASE_URIwhen unset, and still substitutes when set.powersync validate --validate-only=connectionsfails with that name and does not calltestConnection.powersync link self-hostedstill works whenservice.yamlhas unresolved!envURIs.Closes #63