Git Product home page Git Product logo

env2props's Introduction

ENV2PROPS

Codacy Badge CircleCI

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.

Conventions

Each environment variable is transformed as follows:

  • remove the trailing prefix (if specified)
  • trasform all the _ characters into .

Usage

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"

Rationale

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.

Compile

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.

What is Codacy

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.

Among Codacy’s features

  • 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.

Free for Open Source

Codacy is free for Open Source projects.

License

git-version is available under the Apache 2 license. See the LICENSE file for more info.

env2props's People

Contributors

andreatp avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.