0

I have a case in jsonnet where i want to import a file if it exists, otherwise i want to provide a default value.

My dream scenario would be to do something like this:

local file = import "file";

{
    content: if file == null then "default" else file
}

This works if the file contains something, but if the file does not exist it throws an error. Is there a way in jsonnet to do this without the import throwing an exception? It does not look like jsonnet supports any way of try/catch.

0 Answers0