python lib for parse nginx conf files
Project description
chibi_nginx
python lib for parse nginx conf files
Free software: WTFPL
Documentation: https://chibi-nginx.readthedocs.io.
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 details)
Built Distribution
File details
Details for the file chibi_nginx-0.2.2.tar.gz
.
File metadata
- Download URL: chibi_nginx-0.2.2.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef2e96fee1b4c46d3736f11d9814d9342f27d9947843f372df19dc31a996235e |
|
MD5 | 7ee4e3fd1c99454fb69fc2f63cf18087 |
|
BLAKE2b-256 | 8b63044b7b4642b510e3f1f6eb49cd3ef66d5365847d385e5354e4d0999c1021 |
File details
Details for the file chibi_nginx-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: chibi_nginx-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada4a83b7c364b231f25eb390538bbdc43a14f33cc54aa237b4d7bfd6e78c307 |
|
MD5 | 7d5e9f2e88f0a91c3e3e2d1e456a75c4 |
|
BLAKE2b-256 | 700f21d91b14d0fcf539e35e1170419d7439cb9821e5008da2f57e9f5fa0c95d |