JSON Schema Application Environment Configuration and Validation
This package allows you to validate application environment variables that are used for configuration with JSON schemas.
It is extremely useful to use with Docker/kubernetes where you might have quite a bit of configuration originating from environment variables; however, it also provides a nice generic way to define and validate any application configuration with JSON Schema.
Usage
First, define a JSON Schema file(env-schema.json):
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"db_uri": {
"type": "string",
"title": "AMQP host"
}
},
"required": ["db_uri"]
}
Then, validate your environment config(export DB_URI=postgresql://localhost:5432):
import enviral
settings = enviral.validate_env('env-schema.json')
settings['db_uri']
Validate with multiple files:
import enviral
settings = enviral.validate_env('env-schema.json', 'package:validation-file.json')
You can also validate existing objects against JSON schema files:
import enviral
enviral.validate_object({"db_uri": "postgresql://localhost:5432"}, 'env-schema.json')
Or command line validate:
json-schema-env-validator env-schema.json package:validation-file.json
Development
pip install -r requirements.txt
pip install -e .
./bin/pre-commit install
Metadata
Release files for json-schema-env-validator 1.0.6
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 | |
|---|---|---|---|---|
| json-schema-env-validator-1.0.6.tar.gz | 6.9 kB | Without provenance | Details |
Release files / json-schema-env-validator-1.0.6.tar.gz
| Download URL | json-schema-env-validator-1.0.6.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4ec7393d424e70d0007ac5b11a6a4c7c0f1ea1cc2b4cf1ec3b2160186ae34eb
|
|
BLAKE2b-256 checksum How to use checksums |
0b199717fc58a82228ba1173868b3e61e119e596d5b97e06274d18f3a6727ffe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
|
Security for json-schema-env-validator 1.0.6
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.