Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable support for configurations(?) #19

Open
jjg-123 opened this issue Jun 27, 2023 · 2 comments
Open

Add variable support for configurations(?) #19

jjg-123 opened this issue Jun 27, 2023 · 2 comments

Comments

@jjg-123
Copy link
Collaborator

jjg-123 commented Jun 27, 2023

Some ability to set variables in the XML configuration would be nice. Say allow a section like

<vars><key>value</key></vars>

and use them like templates:

${key}

replaces it with the value. E.g.

<fileStore path="${dir}/storage">
   <clients/>
</fileStore>

This would be particularly useful in places where there are, e.g., paths or other things. One question is scope. Do we allow for these globally in the entire configuration or just per section?

@jjg-123
Copy link
Collaborator Author

jjg-123 commented Jun 27, 2023

A further question is where does this apply? Inside of strings? Should not have it inside of tags since that makes invalid XML and we would end up writing an XML pre-processor (which is another option, but quite different).

@jjg-123
Copy link
Collaborator Author

jjg-123 commented Aug 2, 2024

A really simple-minded approach is to allow for a properties file and use the standard replacement template mechanism, so ${OA4MP_HOME} could be inserted, the XML file pre-processed and then handed to the XML parser. That, however, is not self-contained at all.

Might do a partial solution too: Require an initial vars block, read only that (easy to read a single element), set up templates from it, then preprocess the rest of the file. This requires multiple loads and a few other things, but since parsing a configuration file is a one-time operation, that might be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant