-
Notifications
You must be signed in to change notification settings - Fork 1
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 the ability to provide SDML Catalog path via an environment variable #18
base: main
Are you sure you want to change the base?
Conversation
@@ -21,6 +21,7 @@ sdml-errors = { version = "0.3.1", path = "../sdml-errors" } | |||
search_path = "0.1.4" | |||
serde = { version = "1.0.210", features = ["derive"] } | |||
serde_json = "1.0.128" | |||
serial_test = "3.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this down to dev-dependencies
@@ -51,6 +52,9 @@ pub const SDML_FILE_EXTENSION_LONG: &str = "sdml"; | |||
/// The name used for resolver catalog files. | |||
pub const SDML_CATALOG_FILE_NAME: &str = "sdml-catalog.json"; | |||
|
|||
/// The environment variable used to override resolver catalog file location. | |||
pub const SDML_CATALOG_FILE_VARIABLE: &str = "SDML_CATALOG"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this SDML_CATALOG_FILE
, seems easier to understand, and you named the constant SDML_CATALOG_FILE_VARIABLE
after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the change to the Cargo.toml file and environment variable please and this should be an easy one.
This PR adds the ability to provide the path to SDML catalog via an environment variable. It just changes the implementation of the default resolver, so it either takes path from the environment variable if present or it looks in the current folder (and traverses through the parent folders).
I have added unit test that verifies this behavior. Have added dependency on
serial_test
as I need to ensure that the tests touching the environment variables are not running in parallel.Disclaimer: the diff contains also #16 as that allows me to have working tests.