Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PyFund
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
陈涛
PyFund
Commits
4f8bd3cb
Commit
4f8bd3cb
authored
Mar 23, 2023
by
Confusion-ymc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加测试数据库
parent
4d4ae359
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
LOCAL.py
configs/LOCAL.py
+3
-3
__init__.py
configs/__init__.py
+9
-0
mongodb_helper.py
db/mongodb_helper.py
+4
-0
No files found.
configs/LOCAL.py
View file @
4f8bd3cb
from
configs
import
env
from
configs
import
env
,
mongodb_url
class
Settings
:
class
Settings
:
env
=
env
env
=
env
name
=
'本地环境'
name
=
'本地环境'
mongodb
=
'mongodb://127.0.0.1:27017'
mongodb
=
mongodb_url
(
sock_path
=
'13.115.26.128:27018'
,
user_name
=
'root'
,
pwd
=
'ETHQig66tzxoZc+wuIPEUTMVsY'
)
#
'mongodb://13.115.26.128:27017' # test
#
mongodb = mongodb_url('127.0.0.1:27017')
# api
# api
identify_jwt
=
'https://apit.matrixone.io/identity/.well-known/openid-configuration/jwks'
identify_jwt
=
'https://apit.matrixone.io/identity/.well-known/openid-configuration/jwks'
configs/__init__.py
View file @
4f8bd3cb
import
os
import
os
from
urllib.parse
import
quote_plus
def
mongodb_url
(
sock_path
,
user_name
=
None
,
pwd
=
None
):
if
user_name
and
pwd
:
return
f
"mongodb://{quote_plus(user_name)}:{quote_plus(pwd)}@{sock_path}"
else
:
return
f
"mongodb://{sock_path}"
# 获取环境变量
# 获取环境变量
env
=
os
.
getenv
(
"MATRIXONE_ENVIRONMENT"
,
"LOCAL"
)
env
=
os
.
getenv
(
"MATRIXONE_ENVIRONMENT"
,
"LOCAL"
)
...
...
db/mongodb_helper.py
View file @
4f8bd3cb
from
typing
import
Dict
from
typing
import
Dict
from
urllib.parse
import
quote_plus
import
pytz
import
pytz
from
bson
import
CodecOptions
from
bson
import
CodecOptions
...
@@ -33,3 +34,6 @@ def register_mongodb(app):
...
@@ -33,3 +34,6 @@ def register_mongodb(app):
mongodb_manger
=
AioMongodbManager
()
mongodb_manger
=
AioMongodbManager
()
mongodb_manger
.
setup_pool
(
settings
.
mongodb
,
'pyfund'
)
mongodb_manger
.
setup_pool
(
settings
.
mongodb
,
'pyfund'
)
app
.
state
.
mongodb_manger
=
mongodb_manger
app
.
state
.
mongodb_manger
=
mongodb_manger
from
urllib.parse
import
quote
quote
(
'mongodb://root:ETHQig66tzxoZc+wuIPEUTMVsY@13.115.26.128:27018'
)
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