Metadata-Version: 2.1
Name: envtoml
Version: 0.1.1
Summary: A simple way of using environment variables in TOML configs (via interpolation)
Home-page: https://github.com/mrshu/envtoml
License: MIT
Keywords: TOML,environment,variables,config
Author: mr.Shu
Author-email: mr@shu.io
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: coverage (>=4.5,<5.0)
Requires-Dist: nose (>=1.3,<2.0)
Requires-Dist: toml (>=0.10.0,<0.11.0)
Project-URL: Repository, https://github.com/mrshu/envtoml
Description-Content-Type: text/x-rst

envtoml
=======

``envtoml`` is an answer to a fairly simple problem: including values from
environment variables in TOML configuration files. In this way, it is very
similar to both `envyaml <https://github.com/thesimj/envyaml>`_ and
`varyaml <https://github.com/abe-winter/varyaml>`_ which provide very
similar functionality for YAML and which greatly inspired this small
package.

Example
-------

Suppose we have the following configuration saved in ``config.toml``

.. code:: toml

  [db]
  host = "$DB_HOST"
  port = "$DB_PORT"
  username = "$DB_USERNAME"
  password = "$DB_PASSWORD"
  name = "my_database"

with the environment variables being set to the following

.. code::

  DB_HOST=some-host.tld
  DB_PORT=3306
  DB_USERNAME=user01
  DB_PASSWORD=veryToughPa$$w0rd

this config can then be parsed with ``envtoml`` in the following way:


.. code:: python

  from envtoml import load

  cfg = load(open('./config.toml'))

  print(cfg)
  # {'db': {'host': 'some-host.tld',
  #   'port': 3306,
  #   'username': 'user01',
  #   'password': 'veryToughPas$w0rd',
  #   'name': 'my_database'}}

Tests
-----

As this project makes use of `Poetry <https://poetry.eustace.io/>`_, after
installing it the tests can be ran by executing the following from the
project's root directory:

.. code:: bash

    poetry run nosetests tests

They can also be ran with `coverage <https://nose.readthedocs.io/en/latest/plugins/cover.html>`_:

.. code:: bash

    poetry run nosetests --with-coverage tests


License
-------

Licensed under the MIT license (see `LICENSE <./LICENSE>`_ file for more
details).

