Pyramid auto env
A pyramid library to help overwrite ini configs with environment variables.
Getting Started
These instructions will help you install library and use its features.
Installing
pip install pyramid-auto-env
Running the tests
Install test dependencies
pip install -e ".[test]"
Run test
pytest
Using
Replacing the mail.password of the inifile with environment variable
INI FILE
###
# app configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:myproject
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
pyramid_debugtoolbar
mail.password = local
# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1
###
# wsgi server configuration
###
[server:main]
use = egg:waitress#main
listen = localhost:6543
###
# logging configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, pyramid_auto_env
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_pyramid_auto_env]
level = INFO
handlers = console
qualname = pyramid_auto_env
propagate = 0
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
ENVIRONMENT
export MYPROJ_MAIL_PASSWORD = S3kr3t
CODE
from pyramid.config import Configurator
from pyramid_auto_env import get_env_or_ini
@autoenv_settings(prefix='myproj')
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.include('pyramid_jinja2')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.scan()
return config.make_wsgi_app()
ENVVAR Format
The environment variable lookup will search for <prefix.upper()>_<settings_name.upper().replace(['.-', '_'])>
Examples (prefix=MYPROJ):
host.url -> MYPROJ_HOST_URL
mail-smtp -> MYPROJ_MAIL_SMTP
my.project.super-secret -> MYPROJ_MY_PROJECT_SUPER_SECRET
Metadata
Release files for pyramid-auto-env 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyramid_auto_env-0.1.2.tar.gz | 3.6 kB | Without provenance | Details |
Release files / pyramid_auto_env-0.1.2.tar.gz
| Download URL | pyramid_auto_env-0.1.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c19406e04e9444aa7e6da045428546cf58d7cbcad30bd6c6fa4d8c522b3a3803
|
|
BLAKE2b-256 checksum How to use checksums |
8ad7934b6091d4c565b9c526a485eb1145fa8d24357711ed8a0028dc9fd5c5ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3
|
Security for pyramid-auto-env 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.