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

Draft for reading configuration from config files #1722

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Nov 8, 2024

This could be a first draft for #1720

@rPraml rPraml marked this pull request as draft November 8, 2024 09:10
@gbrail
Copy link
Collaborator

gbrail commented Nov 13, 2024

I think that this approach makes sense in that it lets configuration come from the environment, system properties, file, or classpath. I think that's a good thing and that we should follow this pattern.

For actually checking the setting of various flags, however, I think that the config class should parse all this input and set boolean (or enum) values that can be checked directly, rather than relying on a hash lookup. I think that can give us two advantages:

  1. It keeps all the logic about naming and renaming things in one place
  2. It will be faster, since many of these properties, like the various debug flags, will be checked many millions of times potentially while Rhino runs, and all those hash table lookups will dominate performance pretty soon.

@rPraml
Copy link
Contributor Author

rPraml commented Nov 20, 2024

I think I can implement this next week or so...

@gbrail
Copy link
Collaborator

gbrail commented Nov 20, 2024

If you're looking for the kinds of debug flags I'd like to potentially replace with a real debugging mechanism, I would look at these:

public static final boolean printTrees = false;

private static final boolean DEBUGSTACK = false;

And as for feature flags, the first one IMO should be for the reflect and proxy support that's currently languishing in a PR by @rbri

@rPraml
Copy link
Contributor Author

rPraml commented Dec 13, 2024

Unfortunately, I didn't have as much time as I thought, but I wanted to update the draft before Christmas of how I want to do it now.

The idea is, to check all sources (classpath, configfile, system-properties, env - the last one wins) for the settings and parse them immediately in the correct datatype. When a variable is bound to the property rhino.debugLinker for example. I try to check also the upper-camel RHINO_DEBUG_LINKER version.

@gbrail I hope, this goes in the right direction... Unfortunately (or fortunately) I won't be able to continue until next year due to vacation. :)

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.

2 participants