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
ace2b6e2
Commit
ace2b6e2
authored
Mar 09, 2022
by
Soldatoff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил содержимое генерируемого map файла
parent
3a76be47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
nginx-redirector.spec
.gear/nginx-redirector.spec
+1
-1
generators.py
redirector/utils/generators.py
+3
-3
No files found.
.gear/nginx-redirector.spec
View file @
ace2b6e2
%define biname nginx-redirector
%define biname nginx-redirector
Name: nginx-redirector
Name: nginx-redirector
Version: 0.1.
4
Version: 0.1.
5
Release: alt1
Release: alt1
Summary: CLI-utility for building nginx redirects
Summary: CLI-utility for building nginx redirects
...
...
redirector/utils/generators.py
View file @
ace2b6e2
...
@@ -51,7 +51,7 @@ class MapGenerator:
...
@@ -51,7 +51,7 @@ class MapGenerator:
data
=
self
.
start_line
%
project_name
data
=
self
.
start_line
%
project_name
for
arg1
,
arg2
in
redirects
:
for
arg1
,
arg2
in
redirects
:
# print('redirect is', arg1, arg2)
# print('redirect is', arg1, arg2)
data
+=
"
\n\t
%
s
\t
%
s;"
%
(
arg1
,
arg2
)
data
+=
"
\n\t
/
%
s
\t
/
%
s;"
%
(
project_name
+
arg1
,
project_name
+
arg2
)
data
+=
self
.
endline
data
+=
self
.
endline
return
data
return
data
...
@@ -80,7 +80,7 @@ class ConfigGenerator:
...
@@ -80,7 +80,7 @@ class ConfigGenerator:
self
.
option_line
=
"return
%
s;
\n
}
\n
"
self
.
option_line
=
"return
%
s;
\n
}
\n
"
def
generate_config
(
self
,
project_name
,
options
):
def
generate_config
(
self
,
project_name
,
options
):
data
=
(
self
.
start_line
%
project_name
)
+
(
self
.
rewrite_line
%
(
project_name
,
project_name
,
"
break
"
))
+
"}
\n
"
data
=
(
self
.
start_line
%
project_name
)
+
(
self
.
rewrite_line
%
(
project_name
,
project_name
,
"
redirect
"
))
+
"}
\n
"
for
code
in
options
:
for
code
in
options
:
if
code
==
"permanent"
:
if
code
==
"permanent"
:
...
@@ -88,6 +88,6 @@ class ConfigGenerator:
...
@@ -88,6 +88,6 @@ class ConfigGenerator:
elif
code
==
"redirect"
:
elif
code
==
"redirect"
:
data
+=
(
self
.
opt_start_line
%
(
project_name
,
"redirect"
))
+
(
self
.
opt_rewrite_line
%
(
project_name
,
project_name
,
"redirect"
,
"redirect"
))
+
"}
\n
"
data
+=
(
self
.
opt_start_line
%
(
project_name
,
"redirect"
))
+
(
self
.
opt_rewrite_line
%
(
project_name
,
project_name
,
"redirect"
,
"redirect"
))
+
"}
\n
"
else
:
else
:
data
+=
(
self
.
opt_start_line
%
(
project_name
,
code
))
+
(
self
.
opt_rewrite_line
%
(
project_name
,
project_name
,
code
,
"
break
"
))
+
(
self
.
option_line
%
code
)
data
+=
(
self
.
opt_start_line
%
(
project_name
,
code
))
+
(
self
.
opt_rewrite_line
%
(
project_name
,
project_name
,
code
,
"
redirect
"
))
+
(
self
.
option_line
%
code
)
return
data
return
data
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