question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Behaviour of Environment config source is not explicit

See original GitHub issue

The spec mentions that environment variables can be used as config sources. It does not specify if those variables need to be converted to a different format. From how I understood @Emily-Jiang an env variable of MP_METRICS_TAGS should be the same as a config key of mp.metrics.tags that was passed in via e.g. a system property.

cc @jmesnil

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
jmesnilcommented, Nov 30, 2017

Another alternative could be to change the type of the @ConfigProperty’s name to be String[] instead of String:

public @interface ConfigProperty {
    String[] name() default "";
}

With that change, we can specify either no name, a single name or an array of names (that would solve heiko’s issue):

@Inject
@ConfigProperty(name={"MP_METRICS_TAGS", "mp.metrics.tags"})
String tags;

The advantage is that we keep a single @ConfigProperty annotation to configure a property. There is only 1 defaultValue, the names of the properties are ordered.

And afaict, we do not break existing user code, the code below is still valid:

@Inject
@ConfigProperty(name="my.double.property")
private double doubleProperty;

@Inject
// config property names is inferred from the injection point
@ConfigProperty
private int intProperty;

@Emily-Jiang wdyt?

1reaction
jmesnilcommented, Nov 29, 2017

+1 making the @ConfigProperty repeatable is a good idea.

The spec should also clarify how default value interact with repeated @ConfigProperty:

In practice, this means that only the last @ConfigProperty should have a default value otherwise all subsequent ones would not be searched.

wdyt?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration Reference Guide - Quarkus
In this reference guide we're going to describe various aspects of Quarkus configuration. A Quarkus application and Quarkus itself (core and extensions) are ......
Read more >
24. Externalized Configuration - Spring
Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use...
Read more >
Configuration for MicroProfile
Manually defining the Ordinal of a built-in ConfigSource; 5.3. Default ConfigSources. 5.3.1. Environment Variables Mapping Rules.
Read more >
AWS CLI Configuration Variables - AWS Documentation
Configuration values for the AWS CLI can come from several sources: ... this credential source does not work alongside the AWS_PROFILE environment variable....
Read more >
bundle-config - - Set bundler configuration options
Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set will ... will be changed in bundler 3, so it's better not to rely on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found