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

Expose environment configuration in LagomApplication #2448

Open
solarmosaic-kflorence opened this issue Nov 13, 2019 · 3 comments · May be fixed by #2531
Open

Expose environment configuration in LagomApplication #2448

solarmosaic-kflorence opened this issue Nov 13, 2019 · 3 comments · May be fixed by #2531
Labels
good first issue Good for newcomers help wanted Ready and waiting for a volunteer
Milestone

Comments

@solarmosaic-kflorence
Copy link

Lagom Version (1.2.x / 1.3.x / etc)

Current

API (Scala / Java / Neither / Both)

Scala

Expected Behavior

I would like to be able to reference environment configuration in additionalConfiguration.

Actual Behavior

Because the environment configuration is not loaded until after the additionalConfiguration, I have to load it myself with a redundant Configuration.load(environment). It would be nice to instead expose it on the LagomApplication, perhaps as a lazy val, so it can be referenced prior to additionalConfiguration being set.

@solarmosaic-kflorence
Copy link
Author

Perhaps another way of achieving this would be to pass all available configuration into additionalConfiguration as an argument, like:

def additionalConfiguration(configuration: Configuration): AdditionalConfiguration = AdditionalConfiguration.empty

and

  override lazy val configuration: Configuration = {
    val currentConfiguration = Configuration.load(environment) ++ context.playContext.initialConfiguration
    val additionalConfig = new Configuration(additionalConfiguration(currentConfiguration).configuration)
    currentConfiguration ++ additionalConfig
  }

@octonato octonato added good first issue Good for newcomers help wanted Ready and waiting for a volunteer labels Nov 28, 2019
@octonato octonato added this to the Lagom 1.x milestone Nov 28, 2019
@octonato
Copy link
Member

Thanks for reporting this.

I added this issue to the backlog, but it can take some time before someone can find time to pick it.

Would you be interested in sending a PR?

@solarmosaic-kflorence
Copy link
Author

@renatocaval sure, I can submit a PR. I will try to do it on my non-work account sometime over the weekend (I have already signed the CLA there).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Ready and waiting for a volunteer
Development

Successfully merging a pull request may close this issue.

2 participants