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
3a76be47
Commit
3a76be47
authored
Mar 04, 2022
by
Soldatoff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправлена ошибка писка map файла в директориb файла yaml
parent
7d12703b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
13 deletions
+24
-13
nginx-redirector.spec
.gear/nginx-redirector.spec
+12
-2
test.conf
redirector/tests/nginx/location-includes/test.conf
+2
-2
test.conf
redirector/tests/nginx_test_case/location-includes/test.conf
+2
-2
const.py
redirector/utils/const.py
+3
-3
parser.py
redirector/utils/parser.py
+2
-1
setup.py
setup.py
+3
-3
No files found.
.gear/nginx-redirector.spec
View file @
3a76be47
%define biname redirector
%define biname
nginx-
redirector
Name: nginx-redirector
Version: 0.1.
2
Version: 0.1.
4
Release: alt1
Summary: CLI-utility for building nginx redirects
...
...
@@ -44,15 +44,25 @@ NGINX redirector:
%python3_install
mkdir -p %buildroot/var/lib/%biname/location-includes
mkdir -p %buildroot/var/lib/%biname/maps
mkdir -p %buildroot/etc/%biname
%files
/usr/bin/%biname
/usr/bin/%biname-watch
/usr/bin/%biname-convert
/var/lib/%biname/location-includes/
/var/lib/%biname/maps/
/etc/%biname/
%python3_sitelibdir/*
%changelog
* Tue Mar 01 2022 Pablo Soldatoff <soldatoff@etersoft.ru> 0.1.3-alt1
- new version
* Wed Nov 03 2021 Pablo Soldatoff <soldatoff@etersoft.ru> 0.1.2-alt1
- new version
...
...
redirector/tests/nginx/location-includes/test.conf
View file @
3a76be47
if
($
test_redirect
) {
rewrite
^/
test
/(.*)$ $
test_redirect
break
;
rewrite
^/
test
/(.*)$ $
test_redirect
redirect
;
}
if
($
test_permanent_redirect
) {
rewrite
^/
test
/(.*)$ $
test_permanent_redirect
permanent
;
}
if
($
test_status
=
301
_
redirect
) {
rewrite
^/
test
/(.*)$ $
test_status
=
301
_
redirect
break
;
rewrite
^/
test
/(.*)$ $
test_status
=
301
_
redirect
redirect
;
return
status
=
301
;
}
redirector/tests/nginx_test_case/location-includes/test.conf
View file @
3a76be47
if
($
test_redirect
) {
rewrite
^/
test
/(.*)$ $
test_redirect
break
;
rewrite
^/
test
/(.*)$ $
test_redirect
redirect
;
}
if
($
test_permanent_redirect
) {
rewrite
^/
test
/(.*)$ $
test_permanent_redirect
permanent
;
}
if
($
test_status
=
301
_
redirect
) {
rewrite
^/
test
/(.*)$ $
test_status
=
301
_
redirect
break
;
rewrite
^/
test
/(.*)$ $
test_status
=
301
_
redirect
redirect
;
return
status
=
301
;
}
redirector/utils/const.py
View file @
3a76be47
...
...
@@ -8,9 +8,9 @@ PYTHON_VERSION = "3.8.1"
VERSION_STATUS
=
"alpha"
# directory with maps files
MAPS_DIR
=
os
.
environ
.
get
(
"MAPS_DIR"
,
"/var/lib/redirector/maps"
)
MAPS_DIR
=
os
.
environ
.
get
(
"MAPS_DIR"
,
"/var/lib/
nginx-
redirector/maps"
)
# directory with generated files
CONFIG_DIR
=
os
.
environ
.
get
(
"CONFIG_DIR"
,
"/var/lib/redirector/location-includes"
)
CONFIG_DIR
=
os
.
environ
.
get
(
"CONFIG_DIR"
,
"/var/lib/
nginx-
redirector/location-includes"
)
# main yaml-config
CONFIG
=
os
.
environ
.
get
(
"CONFIG"
,
"/etc/redirector/config.yaml"
)
CONFIG
=
os
.
environ
.
get
(
"CONFIG"
,
"/etc/
nginx-
redirector/config.yaml"
)
redirector/utils/parser.py
View file @
3a76be47
...
...
@@ -116,11 +116,12 @@ class ConfigReader:
# normalize path
yaml_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
yaml_file
))
# get yaml file directory for restore rel path to map file
map_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
map_file
))
map_file_name
=
os
.
path
.
basename
(
map_file
)
# get filename from arg
try
:
for
map_path
,
prefix
in
self
.
parse_yaml
(
yaml_file
):
abs_map_path
=
get_map_path
(
map_path
,
yaml
_dir
)
abs_map_path
=
get_map_path
(
map_path
,
map
_dir
)
if
map_file_name
not
in
abs_map_path
:
continue
...
...
setup.py
View file @
3a76be47
...
...
@@ -30,9 +30,9 @@ setup(
packages
=
[
'redirector'
,
'redirector.utils'
,
'redirector.tests'
],
entry_points
=
{
'console_scripts'
:
[
'redirector = redirector.redirector:main'
,
'redirector-watch = redirector.watcher:watch'
,
'redirector-convert = redirector.htaccess_parser:main'
'
nginx-
redirector = redirector.redirector:main'
,
'
nginx-
redirector-watch = redirector.watcher:watch'
,
'
nginx-
redirector-convert = redirector.htaccess_parser:main'
]
},
classifiers
=
classifiers_list
,
...
...
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