Caddy: v2: config adapter for yaml

Created on 11 Nov 2019  路  5Comments  路  Source: caddyserver/caddy

1. What would you like to have changed?

An adapter for reading config in YAML

2. Why is this feature a useful, necessary, and/or important addition to this project?

Writing JSON, that too nested, by hand is hard and error prone. I think YAML would be a better option for writing config by hand. Also YAML supports comments. Even though JSON-C and JSON5 does support comments, YAML would be more familiar to people since it's used to configure lot of things now.

3. What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

Writing config using other options like a Caddyfile, JSON-C and JSON5.

4. Please link to any relevant issues, pull requests, or other discussions.

feature request

Most helpful comment

I have made an adapter here: https://github.com/iamd3vil/caddy_yaml_adapter

All 5 comments

Good idea -- thanks for raising an issue about it.

This should be easy! I bet this can be done in like 10 lines of code. Just take the YAML input, deserialize it, then re-serialize as JSON. If anyone wants to build this, go ahead -- link to it here when you're ready to show it off!

(This isn't something that has to be added to the core repo, at least until #2780 is figured out.)

This should be easy! I bet this can be done in like 10 lines of code. Just take the YAML input, deserialize it, then re-serialize as JSON. If anyone wants to build this, go ahead -- link to it here when you're ready to show it off!

One could use https://github.com/ghodss/yaml - yaml.YAMLToJSON. It handles all the caveats...

I have made an adapter here: https://github.com/iamd3vil/caddy_yaml_adapter

Nice!! Thanks for making that. I'm working on the new website and once it's done we'll be able to add all the modules there for people to find.

@iamd3vil Linked on our new docs page: https://caddyserver.com/docs/config-adapters

Thanks! When the new site is finished, there will probably be a way for you to log in and register its listing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lorddaedra picture lorddaedra  路  3Comments

billop picture billop  路  3Comments

SteffenDE picture SteffenDE  路  3Comments

la0wei picture la0wei  路  3Comments

mikolysz picture mikolysz  路  3Comments