Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
9b5b48dd
Commit
9b5b48dd
authored
May 24, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改settings conf配置
parent
75fb37d2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
conf.py
apps/jumpserver/conf.py
+15
-5
settings.py
apps/jumpserver/settings.py
+2
-0
No files found.
apps/jumpserver/conf.py
View file @
9b5b48dd
...
@@ -273,6 +273,19 @@ class Config(dict):
...
@@ -273,6 +273,19 @@ class Config(dict):
if
default_value
is
None
:
if
default_value
is
None
:
return
v
return
v
tp
=
type
(
default_value
)
tp
=
type
(
default_value
)
# 对bool特殊处理
if
tp
is
bool
and
isinstance
(
v
,
str
):
if
v
in
(
"true"
,
"True"
,
"1"
):
return
True
else
:
return
False
if
tp
in
[
list
,
dict
]
and
isinstance
(
v
,
str
):
try
:
v
=
json
.
loads
(
v
)
return
v
except
json
.
JSONDecodeError
:
return
v
try
:
try
:
v
=
tp
(
v
)
v
=
tp
(
v
)
except
Exception
:
except
Exception
:
...
@@ -289,14 +302,10 @@ class Config(dict):
...
@@ -289,14 +302,10 @@ class Config(dict):
except
KeyError
:
except
KeyError
:
value
=
None
value
=
None
if
value
is
not
None
:
if
value
is
not
None
:
return
self
.
convert_type
(
item
,
value
)
return
value
# 其次从环境变量来
# 其次从环境变量来
value
=
os
.
environ
.
get
(
item
,
None
)
value
=
os
.
environ
.
get
(
item
,
None
)
if
value
is
not
None
:
if
value
is
not
None
:
if
value
.
lower
()
==
'false'
:
value
=
False
elif
value
.
lower
()
==
'true'
:
value
=
True
return
self
.
convert_type
(
item
,
value
)
return
self
.
convert_type
(
item
,
value
)
return
self
.
defaults
.
get
(
item
)
return
self
.
defaults
.
get
(
item
)
...
@@ -362,6 +371,7 @@ defaults = {
...
@@ -362,6 +371,7 @@ defaults = {
'HTTP_LISTEN_PORT'
:
8080
,
'HTTP_LISTEN_PORT'
:
8080
,
'LOGIN_LOG_KEEP_DAYS'
:
90
,
'LOGIN_LOG_KEEP_DAYS'
:
90
,
'ASSETS_PERM_CACHE_TIME'
:
3600
,
'ASSETS_PERM_CACHE_TIME'
:
3600
,
}
}
...
...
apps/jumpserver/settings.py
View file @
9b5b48dd
...
@@ -371,6 +371,8 @@ REST_FRAMEWORK = {
...
@@ -371,6 +371,8 @@ REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES'
:
(
'DEFAULT_PARSER_CLASSES'
:
(
'rest_framework.parsers.JSONParser'
,
'rest_framework.parsers.JSONParser'
,
'rest_framework.parsers.FormParser'
,
'rest_framework.parsers.FormParser'
,
'rest_framework.parsers.MultiPartParser'
,
'rest_framework.parsers.FileUploadParser'
,
'common.parsers.JMSCSVParser'
'common.parsers.JMSCSVParser'
),
),
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
...
...
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