I couldn’t find in the documentation that this wont work, still, when I am trying it I get Error: adapting config using caddyfile: /etc/caddy/Caddyfile:48: unrecognized directive: {my_snippet}
I think maps is for mapping one value to another for use within other directives, not for controlling the inclusion of entire directives or files. The error unrecognized directive: {my_snippet} is because Caddy is trying to interpret {my_snippet} as a directive itself, which it isn’t.
I think import would work, but I’m unsure if it will be boolean. If you set an environmental variable like this:
Using the env var as you mentioned in the example do work indeed.
But it’s kind of messy, I would prefer to keep the env var simple, like a boolean or a yes/no thing.