Skip to main content

python lib for parse nginx conf files

Project description

chibi_nginx

https://img.shields.io/pypi/v/chibi_nginx.svg https://img.shields.io/travis/dem4ply/chibi_nginx.svg Documentation Status

python lib for parse nginx conf files

Install

pip install chibi-nginx

Usage

cat > /etc/nginx/sites_available/default.conf << 'endmsg'
# vi: set ft=nginx:
server {
                server_name $hostname nginx;
                listen 80;

                access_log /var/log/nginx/default_access.log;
                error_log /var/log/nginx/default_error.log;

                root /var/www/default/;
                index index.html;
}
endmsg
from chibi_nginx import Chibi_nginx

tmp = Chibi_nginx( '/etc/nginx/sites_available/default.conf' )
result = tmp.read()
expected = {
        'server': {
                'server_name': '$hostname nginx',
                'listen': '80',
                'access_log': '/var/log/nginx/default_access.log',
                'error_log': '/var/log/nginx/default_error.log',
                'root': '/var/www/default/',
                'index': 'index.html'}
}
assert result == expected
result[ 'server' ][ 'root' ] = '/home/user/default_site/'
tmp.write( result )
new_result = tmp.read()
assert new_result[ 'server' ][ 'root' ] = '/home/user/default_site/'

Features

  • read and write config files of nginx

History

1.0.0 (2026-01-28)

  • @nbtm-sh add support for single word keywords

0.2.1 (2022-03-24)

  • a more proper readme

0.2.0 (2022-03-19)

  • improvent in the output when write or change a .conf file

0.1.0 (2022-01-25)

  • read and write .conf files of nginx

0.1.0 (2021-10-25)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chibi_nginx-1.0.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chibi_nginx-1.0.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file chibi_nginx-1.0.0.tar.gz.

File metadata

  • Download URL: chibi_nginx-1.0.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for chibi_nginx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6d5572e0bc7310ead58f8a9f7be926afd162ad9c17da7e31c3624c2fb88ab296
MD5 389f556e8709114c6b29a456ee7777ff
BLAKE2b-256 12bf9082528ca36fe84608a625b18d55ed69926ddad67627ee9e6b3f4f88ab36

See more details on using hashes here.

File details

Details for the file chibi_nginx-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: chibi_nginx-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for chibi_nginx-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e01e7ddbc522613c1105ad187e35cc59ffaf7f69b693380235df50602e252326
MD5 40ae20abeffe3c2fde61c424b4215a52
BLAKE2b-256 3ec21affa5ef3282238dc1325693dcb0c9f35ebf878cd2a35353aa8f23a15b09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page