Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nginx-redirector
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
nginx-redirector
Commits
6d65e8c8
Commit
6d65e8c8
authored
Jun 05, 2021
by
Давид Добряков
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete redirector/conf
parent
211f4fa8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
59 deletions
+0
-59
__init__.py
redirector/conf/__init__.py
+0
-2
config.ini
redirector/conf/config.ini
+0
-5
config.py
redirector/conf/config.py
+0
-52
No files found.
redirector/conf/__init__.py
deleted
100644 → 0
View file @
211f4fa8
#!/usr/bin/env python
# -*- coding: utf-8 -*-
redirector/conf/config.ini
deleted
100644 → 0
View file @
211f4fa8
[DEFAULT]
nginx_dir
=
/etc/nginx
maps_dir
=
%(nginx_dir)s/maps
config_dir
=
%(nginx_dir)s/location-includes
redirector/conf/config.py
deleted
100644 → 0
View file @
211f4fa8
import
configparser
import
argparse
as
ap
import
os
class
Config
:
def
__init__
(
self
):
self
.
config
=
configparser
.
ConfigParser
()
self
.
filename
=
'{}/config.ini'
.
format
(
os
.
path
.
dirname
(
__file__
))
def
read_config
(
self
,
filename
=
None
):
if
filename
:
self
.
filename
=
filename
self
.
config
.
read
(
self
.
filename
)
def
get_default_dir
(
self
,
dir_key
):
default_dir
=
self
.
config
[
'DEFAULT'
][
dir_key
]
return
default_dir
def
rewrite_default_dir
(
self
,
dir_key
,
new_val
):
self
.
config
[
'DEFAULT'
][
dir_key
]
=
new_val
f
=
open
(
self
.
filename
,
'w'
)
self
.
config
.
write
(
f
)
f
.
close
()
def
show_config
(
self
):
f
=
open
(
self
.
filename
,
'r'
)
print
(
f
.
read
())
f
.
close
()
def
main
():
parser
=
ap
.
ArgumentParser
(
description
=
'Redirector configure utility'
)
parser
.
add_argument
(
'--show'
,
help
=
'Show current config file content.'
,
action
=
'store_true'
)
parser
.
add_argument
(
'--edit'
,
action
=
'store'
,
nargs
=
2
,
help
=
'Edit one of params.
\n
Usage: redirector-config --edit NGINX_DIR /etc/nginx2'
)
args
=
parser
.
parse_args
()
config
=
Config
()
config
.
read_config
()
if
args
.
show
:
config
.
show_config
()
if
args
.
edit
:
config
.
rewrite_default_dir
(
args
.
edit
[
0
],
args
.
edit
[
1
])
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment