Merging datasource with optional file #1129
-
I'm trying to merge default config files with optional config overrides like in the example. But I can't figure it out. Can someone give me a hint how to solve it? ExampleDirectory structure:
Run Expected
Example as Zip: example.zip |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @m4rcs, thanks for posting with all this detail!
Are you referring to your example? Or was there some other example or documentation that implies that it's possible to refer to a missing file? Datasources require valid URLs that refer to an existing resource. Here's what I got when I ran the command: $ gomplate --config ./gomplate.yml
08:59:06 ERR error="template: templates/config.yml.tpl:4:13: executing \"templates/config.yml.tpl\" at <ds \"database\">: error calling ds: Couldn't read datasource 'database': Couldn't read datasource './config/database.yml': Can't stat /Users/hairyhenderson/temp/config/database.yml: stat /Users/hairyhenderson/temp/config/database.yml: no such file or directory" It works if I create an empty $ touch config/database.yml
$ gomplate --config ./gomplate.yml
$ cat config.yml
common:
timezone: "Europe/Berlin"
database:
host: "localhost" You may be able to work around this by referring to a nonexistent datasource and then optionally defining it in the template through some combination of The best approach would be simply to provide an empty override file. It's possible that I could alter the |
Beta Was this translation helpful? Give feedback.
Hi @m4rcs, thanks for posting with all this detail!
Are you referring to your example? Or was there some other example or documentation that implies that it's possible to refer to a missing file? Datasources require valid URLs that refer to an existing resource.
Here's what I got when I ran the command: