Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
modconfig #########
.. _description:
modconfig -- Simple hierarchic configuration manager for apps
.. _badges:
.. image:: https://github.com/klen/modconfig/workflows/tests/badge.svg :target: https://github.com/klen/modconfig/actions :alt: Tests Status
.. image:: https://img.shields.io/pypi/v/modconfig :target: https://pypi.org/project/modconfig/ :alt: PYPI Version
.. _motivation:
Applications (especially web services) often require certain configuration
options to depend on the environment an application runs in (development,
testing, production, etc.). For instance, a database address config option may
default to a local database server during development, a mock database server
during testing, and yet another database server during production. It may also
need to be customizable via an environment variable. modconfig
approaches
scenarios like this and, allows to specify default configuration options for
various environments and optionally override them by custom environment
variables.
modconfig
uses python modules for keep the configuration options. You are
not locked by format (json, yaml, ini) restrictions and able to use any python
statements/modules to tune your configuration as a pro. It keeps the
flexability and make your configuration very declarative without any magic.
.. _contents:
.. contents::
.. _requirements:
.. _installation:
modconfig should be installed using pip: ::
pip install modconfig
.. _usage:
For example you have the structure in your app:
.. code::
|- myapp/ | |- init.py | |- config/ | | |- init.py | | |- defaults.py | | |- production.py | | |- stage.py | | |- tests.py | | ...
See https://github.com/klen/modconfig/tree/develop/example as a simple reference.
Initialize the config in your app and use it anywhere:
.. code:: python
from modconfig import Config
cfg = Config(
# instead an import path it could be the module itself
'myapp.config.production',
# Override any options
ANY_OPTION1="VALUE", ANY_OPTION2="VALUE")
assert cfg.DATABASE assert cfg.ANY_OPTION1
If you provide a several modules, modconfig
will be using the first available:
.. code:: python
from modconfig import Config
cfg = Config('myapp.config.local', 'myapp.config.production', ANY_OPTION1="VALUE")
assert cfg.DATABASE assert cfg.ANY_OPTION1
The module path may be set as ENV variable:
.. code:: python
import os from modconfig import Config
os.environ['MODCONFIG'] = 'myapp.config.production'
cfg = Config('env:MODCONFIG', 'myapp.config.local') assert cfg.DATABASE
Any option may be redifened with ENV variables. By default the modconfig
tries to parse value as a JSON which allows us to set complex values (dict,
list, etc). If value is not JSON it would be parsed as str.
Any ENV variables which names are not contained in source module would be ignored.
See https://github.com/klen/modconfig/tree/develop/tests.py for more examples.
.. _bugtracker:
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/modconfig/issues
.. _contributing:
Development of the project happens at: https://github.com/klen/modconfig
.. _license:
Licensed under a MIT license
_.
.. _links:
.. _klen: https://github.com/klen
.. _MIT license: http://opensource.org/licenses/MIT
FAQs
Simple hierarchic configuration manager for apps
We found that modconfig demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.