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

Read configurations from InputStream #2088

Closed
melburne opened this issue Mar 8, 2021 · 1 comment
Closed

Read configurations from InputStream #2088

melburne opened this issue Mar 8, 2021 · 1 comment

Comments

@melburne
Copy link

melburne commented Mar 8, 2021

Currently, net.opentsdb.utils.Config has a constructor that accepts a path to the OpenTSDB configuration file.

/**
 * Constructor that initializes default values and attempts to load the given
 * properties file
 * @param file Path to the file to load
 * @throws IOException Thrown if unable to read or parse the file
 */
public Config(final String file) throws IOException {
  loadConfig(file);
  setDefaults();
}

Since the structure of an application changes when it is packaged as a JAR file, this path would no longer be valid for applications using this constructor that are deployed as JAR files. (assuming the configuration file is store under src/main/resources)

Would it make sense to add another constructor that accepts an InputStream of the contents of the configuration file instead of just a path to the file? Or are there any other ways to set the configurations in a JAR if the file is placed under src/main/resources?

I'd be happy to open a PR for the same if this sounds like a valid usecase.

@manolama
Copy link
Member

Yes that sounds like a good use case so if you don't mind adding another ctor with the stream we can load it. 3.x supports remote URLs but you should open an issue against that to support streams as well.

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

No branches or pull requests

2 participants