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

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-0.2.2.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

chibi_nginx-0.2.2-py2.py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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