This is a tool to transform your environment variables into the java Properties format intended to be passed from the command line.
e.g.:
$ env
LC_PAPER=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LANG=en_US.UTF-8
$ env2props
-DLC.PAPER="en_US.UTF-8" -DLC.MONETARY="en_US.UTF-8" -DLANG="en_US.UTF-8"
Under the option -p
or --prefix
you can pass a matching prefix for the environment variables.
e.g.:
$ env
LC_PAPER=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LANG=en_US.UTF-8
$ env2props -p LC_
-DPAPER="en_US.UTF-8" -DMONETARY="en_US.UTF-8"
The output is provided on standard output and without any additional new-line, as it is intended to be used in-line within java command execution.
Each environment variable is transformed as follows:
- remove the trailing prefix (if specified)
- trasform all the
_
characters into.
After making the binary executable and available on the PATH
(should work out-of-the-box on any linux machine).
You can use this tool in-line while launching java applications e.g.:
sh -c "java $(env2props) -jar <application>.jar"
According to the Twelve-factor App the configuration should be passed to the applications via environment variables.
The "de-facto" standard for configuration in Scala application is Typesafe Config and env variables are a supported fallback; still it is not possible to override virtually any configuration of our application if not properly encoded the binding accordingly.
Although Typesafe Config offers a first class integration with Java system properties:
users can override the config with Java system properties
This makes it easy to bridge the gap and by having a standard way to convert environment variables into Java system properties make it possible to fully comply with Twelve-factor App.
You need to have the crystal compiler available in your classpath to succesfully build this utility, otherwise you can compile it statically using a docker image using make buildStatic
.
Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
Codacy is free for Open Source projects.
git-version is available under the Apache 2 license. See the LICENSE file for more info.