Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

env2cli

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env2cli

Converts environment variables into cli arguments for easy maintainable docker entry point

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

Env2Cli

Desription

Instead of maintain ugly and long entrypoint scripts to call your module with environment variables as arguments from your dockerfile, just add this elegant converting framework from environment variables to cli command line arguments.

Installation

.. code-block:: bash

pip install env2cli

Usage

Assume your old dockerfile looked like this

.. code-block:: Dockerfile

...
ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT python main.py ${POSITIONAL_ARG} -p ${SOME_PARAM} --other ${OTHER_PARAM} ...

Add new file, for example, entrypoint.py like this:

.. code-block:: python

from main import main
from env2cli import * 

argv = bulk_apply([
    Argument('POSITIONAL_ARG'),
    Argument('SOME_PARAM', '-p'),
    Argument('OTHER_PARAM', '--other')
])

main(argv)

And the new dockerfile should be looking like this:

.. code-block:: Dockerfile

ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT python entrypoint.py

Or even if your program isn't python!

.. code-block:: Dockerfile

ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT ./myprog $(env2cli.py)
# instead ENTRYPOINT ./myprogram ${POSITIONAL_ARG} -p ${SOME_PARAM} --other ${OTHER_PARAM}

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc