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.

Support additional property sources during configuration

See original GitHub issue

During a brainstorm for removing the explicit runner found in https://github.com/moditect/layrry-examples/tree/master/modular-tiles I thought it might be a good idea to provide the Layrry launcher with an addition source of properties that can be used for placeholder substitution, something akin to

`java -jar layrry-launcher.jar --layers-config layers.yml --properties layrry.properties`

The launcher would then read the properties file and place all properties into the Mustache scope, allowing placeholder substitutions. This could turn a somewhat static Layers config file into a “self updatable” config source, as [groupId, artifactId, version] could be provided by external properties. No need to provide a similar layers.yml file to update a version (say from groovy-json:3.0.5 to groovy-json:3.0.6) but also may handle artifact relocation.

Example: Groovy 3 is currently published with groupId = org.codehaus.groovy. Groovy 4 will change to groupId = org.apache.groovy.

A layers file that requires Groovy could declare a module definition as

"{{groovy.groupId}}:groovy-json:{{groovy.version}}"

Explicit definition of an additional properties source makes sense for locally launched applications but may pose a security risk with remotely launched applications (see #37) where you’d want the property source to come from the same trusted host (and adjacent location perhaps) as the layers config file. An implicit mode could be implemented

  1. Given the path of the config layers file replace the filename extension with .properties. If a match is found, use it.
  2. Given the path of the config layers file, locate a file named layrry.properties. If a match is found, use it.
  3. If there are no matches in 1) and 2) then no implicit property sources will be used.

Of course, explicit declaration such as --properties my-props.properties win over implicit, such that if the explicit file is not found then no implicit search will be performed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
gunnarmorlingcommented, Oct 10, 2020

I’ve got a gut feeling that 3&2 > 4 > 1 is good enough

👍

if we need to loosen up at a later date then 4 > 2&3 > 1 is the way to go.

I still think it should then be 4 > 1 > 2&3, but let’s cross that bridge when we get there 😃

0reactions
gunnarmorlingcommented, Oct 11, 2020

Done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the best way to add a new property source in Spring?
I got this working by adding a custom initiailizer to my spring boot app: @SpringBootApplication public class MyApp { public static void main(String[]...
Read more >
24. Externalized Configuration - Spring
You can use properties files, YAML files, environment variables, and command-line arguments to externalize configuration.
Read more >
Properties with Spring and Spring Boot - Baeldung
Spring Boot supports a multitude of property sources, implementing a well-thought-out ordering to allow sensible overriding. It's worth ...
Read more >
Spring @PropertySource - DigitalOcean
There is another way to load multiple property files for a configuration class. @PropertySources({ @PropertySource("classpath:db.properties"), @ ...
Read more >
External Configuration Data in Spring - Spring Framework Guru
YAML supports lists and maps as hierarchical properties and compared to the .properties file, the YAML version is more readable. Imagine we want ......
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