Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
funasr_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
You need to sign in or sign up before continuing.
Commit 09001a49
authored
Aug 22, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]subfix
1 parent
89901ce3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
config/config.py
config/config.py
View file @
09001a4
...
...
@@ -2,10 +2,27 @@ import sys
from
log.logger
import
log
import
os
def
extract_sys_param
(
param_name
,
default_value
):
env_index
=
None
for
i
,
arg
in
enumerate
(
sys
.
argv
):
if
arg
==
f
"--{param_name}"
:
env_index
=
i
break
# 提取 --env 参数的值
if
env_index
is
not
None
and
env_index
+
1
<
len
(
sys
.
argv
):
env_value
=
sys
.
argv
[
env_index
+
1
]
print
(
f
"Environment extract_param {param_name}: {env_value}"
)
return
env_value
else
:
print
(
f
"No {param_name} parameter provided."
)
return
default_value
class
ConfigInfo
:
# environment = sys.argv[2] if len(sys.argv) > 1 else "dev"
environment
=
os
.
environ
.
get
(
'env'
,
'dev'
)
# environment = os.environ.get('env', 'dev')
environment
=
extract_sys_param
(
'env'
,
'dev'
)
log
.
info
(
f
"environment:{environment}"
)
# environment = os.environ.get('ENV')
if
environment
==
'release'
:
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment