related: #741
Reading the docs, I get that I can define an anchor inside some pre-defined element(s), as shown in the issue above:
hosts:
"example.com":
listen:
port: 443
ssl:
certificate-file: /path/to/example.com.crt
key-file: /path/to/example.com.crt
paths: &default_paths
"/":
file.dir: /path/to/doc-root
"example.org":
listen:
port: 443
ssl:
certificate-file: /path/to/example.org.crt
key-file: /path/to/example.org.crt
paths: *default_paths
But it gets harder to read when your config file gets bigger. I tried cutting all anchors out:
anchors:
https_settings: &https
port: 443
default_paths: &default_paths
"/":
file.dir: /path/to/doc-root
hosts:
"example.com":
listen:
<<: *https
ssl:
certificate-file: /path/to/example.com.crt
key-file: /path/to/example.com.crt
paths: *default_paths
"example.org":
listen:
<<: *https
ssl:
certificate-file: /path/to/example.org.crt
key-file: /path/to/example.org.crt
paths: *default_paths
without any luck. I get Apr 25 21:47:27 ip-10-0-0-65 h2o[4530]: [/etc/h2o/h2o.conf:1] unknown command: anchors error logs.
Do we already have some predefined namespace (element) to do things like this? If not, I really want to have something like this, where things included in that particular element (anchors) will just be interpolated.
!file will help you?
https://h2o.examp1e.net/configure/syntax_and_structure.html#including_files
yeah, I'm currently doing that, but dividing everything into pieces of files looks very bad to me (partially because relative paths are not recognized in !file). I don't want to jump around little files just for one row :(
I filed https://github.com/h2o/h2o/pull/1739, which adds stash directive.
To write a configuration file you need to learn Rack specs Yaml Ruby than Mruby of course H2o web server.....Of course it is very flexible you can write anything you want but If you learn those additional things otherwise you cannot write anything and H2o wev server will be become useless for you....
I tried the master branch, and seems it works very good! Thanks i110! I'll close this.
Most helpful comment
I filed https://github.com/h2o/h2o/pull/1739, which adds
stashdirective.