Skip to content

use relative paths in harper config#274

Open
ldt1996 wants to merge 9 commits intomainfrom
config-relative-paths
Open

use relative paths in harper config#274
ldt1996 wants to merge 9 commits intomainfrom
config-relative-paths

Conversation

@ldt1996
Copy link
Contributor

@ldt1996 ldt1996 commented Mar 21, 2026

No description provided.

@ldt1996 ldt1996 requested a review from a team as a code owner March 21, 2026 01:11
@Ethan-Arrowood
Copy link
Member

This is good! Unit Test failure seems related to changes. Please take a look

logging_rotation_workerinterval: 'logging.rotation.workerInterval',
};

const CONFIG_PATH_KEYS = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also a number of TLS certificate paths that can be configured, and it also possible to configure paths for loggers for any component, which isn't a key that that can known ahead of it. I think we probably need to have a mechanism for reading a path from the config file and use that utility in any code that needs to get a path from config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking of adding a getConfigPath(param) utility that resolves any config value against rootPath, but there are muliple existing getConfigValue() callers that expect absolute paths. Should I also keep resolving the known core paths in memory at startup for backwards compat, or do you suggest a a different approach?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we really need to update all code that calls getConfigValue() to get path and change it to use your proposed getConfigPath (that's a great idea). Converting paths in memory seems like it would be problematic for saving changes to the config file, possible? (we don't want to change to absolute paths any time there is an edit to a config file).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, ready for review 58cb002

@ldt1996
Copy link
Contributor Author

ldt1996 commented Mar 23, 2026

This is good! Unit Test failure seems related to changes. Please take a look

Great catch, I didn't update the unit tests. Looks like it's passing now after the fix.

Copy link
Member

@kriszyp kriszyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great!

* Use this for any config param that represents a file/directory path.
* @param param
*/
function getConfigPath(param) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some places we are replacing resolvePath with getConfigPath, but I think resolvePath also handled tilde references to the home directory (like '~/hdb/logs'). Maybe we should add that to getConfigPath as well (at least for back-compat, if not also for convenience)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a great call, I'm thinking this should work d6676b4

Copy link
Member

@kriszyp kriszyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@kriszyp
Copy link
Member

kriszyp commented Mar 26, 2026

FWIW, when I run this, I do still see one absolute path:

tls:
  privateKey: /home/kzyp/harper/keys/privateKey.pem

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

Successfully merging this pull request may close these issues.

4 participants