Skip to main content

Configula

Creates a single configuration by merging settings defined in: 1. in environment variables 2. in toml file

Values provided in environment variables have priority over values from toml configuration file.

By default all environment variables are prefixed with 'PAPERMERGE'. By default __ (two underscores) is used as delimiter in environment variables names. For example, given following toml file:

[main]
secret_key = 1234
[ocr]
default_language = 'deu'

corespondent environment variables names are PAPERMERGE__MAIN__SECRET_KEY and PAPERMERGE__OCR__DEFAULT_LANGUAGE - notice two underscores separate section name from prefix and variable name. Environment variable name format is (all in uppercase):

 <prefix><delimiter><section_name><delimiter><variable_name>

Although in toml files you can place variable names outside sections, in Papermerge all variables must be placed in sections.

By default Configula looks up for following toml file:

  • /etc/papermerge/papermerge.toml
  • /etc/papermerge.toml
  • papermerge.toml

If you have custom location (or custom file name), use PAPERMERGE__CONFIG (notice double underscores) environment variable to point to it:

PAPERMERGE__CONFIG=/app/config/pm.toml

Installation

$ poetry add configula

Usage

from configula import Configula

config = Configula()

default_language = config.get('ocr', 'default_language')
secret_key = config.get('main', 'secret_key')

Where papermerge.toml has the following content:

[main]
secret_key = 5432

[ocr]
default_language = 'deu'

Default language can be overwritten by environment variable PAPERMERGE__OCR__DEFAULT_LANGUAGE and secret_key can overwritten by environment variable PAPERMERGE__MAIN__SECRET_KEY

If you want to read variable from a section use configula.get(section, var_name, default_value) method.

Metadata

Release files for configula 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for configula 0.5.4
File Size Uploaded Provenance
configula-0.5.4.tar.gz 7.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for configula 0.5.4
File Interpreter ABI Platform
configula-0.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / configula-0.5.4.tar.gz

Download URL configula-0.5.4.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1d9d4f6dc48d024a4fcd0d5de2751cf1765ba9c9adeb0530c9ad1f8eed5cf79
BLAKE2b-256 checksum
How to use checksums
6bf4264ae6661d49eab4ab5e7a7571cf95fcfc0226316785525292b30124b74f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / configula-0.5.4-py3-none-any.whl

Download URL configula-0.5.4-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acfb69fa1d86e40acec09c8822d518790f7d15ddfc0926939f1e40d2759234d8
BLAKE2b-256 checksum
How to use checksums
ffccda8d04e7a138bb4d7a64c2f32c2bc2fd145864311d34b2a1d9694f146e02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Security for configula 0.5.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page