tmtsoftware / icd

ICD - Interface Control Document Management
Other
12 stars 5 forks source link

Support of includes? #54

Closed jasonweiss closed 6 years ago

jasonweiss commented 6 years ago

It might be nice to use HOCON includes to link in parts of other config files, especially in the case of multiple instantiations of a shared HCD. For example, if IRIS has a Galil for IFS and a Galil for OIWFS, it may use the same HCD code but have different names. So there would be two component config files with different component values (e.g. galil-ifs, galil-oiwfs), but the other model files would be exactly the same, since they are using the same codebase.

You could imagine shared publish, subscribe, and command model files (e.g. galil-publish.conf, galil-subscribe.conf, galil-command.conf), and then the component specific model files could just include them:

# something like:
# include url("https://github.com/tmt-icd/TMT-Model-Files/blob/master/shared/hcd/galil-subscribe-model.conf")
# or for local files, something like:
include file("../../shared/hcd/galil-subscribe-model.conf")

component = galil-oiwfs

I experimented with this but I couldn't get it to work out of the box. It might be that there is no root object for the model file configs.

https://github.com/lightbend/config/blob/master/HOCON.md#include-semantics-merging

jasonweiss commented 6 years ago

Ha! Sorry, anyone listening. I think it does work out of the box. Had a small problem in my experiment. Will test more to confirm, but will close the issue for now.

jasonweiss commented 6 years ago

OK. I've gotten includes from files and urls working. For files, you need the full path, but we probably have to use url's, so configs don't have paths specific to any computer. So to get the proper URL from github, browse to the file you want to include, then click the Raw button, and then copy the URL from the address bar.