Archived
update: 更新配置文件
This commit is contained in:
1 file changed
+14
-13
+14
-13
@@ -5,22 +5,23 @@
|
|||||||
# @Create Time: 2022/9/11
|
# @Create Time: 2022/9/11
|
||||||
# @File Name: config.py
|
# @File Name: config.py
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""
|
"""
|
||||||
database type. Default is sqlite
|
Available database: sqlite3, Redis.
|
||||||
database file path is "./src/db/data.sqlite", it is not exists, before you run server first
|
Redis: "redis://host:port@password".
|
||||||
remote sqlite file url is "https://pac.rtst.tech/static_file_hosting/static/counter/data.sqlite"
|
If your database doesn't have password, just don't type "@password".
|
||||||
you can download it manually
|
Don't type ":" to use default port.
|
||||||
if you want to use mysql then replace "mysql://[Username]:[password]@[host]:[port]/[database]" with "sqlite"
|
|
||||||
example: mysql://root:114514@127.0.0.1:3306/homo
|
|
||||||
"""
|
"""
|
||||||
database = "mysql://counter:114514@111.173.80.154:26098/Counter"
|
database = "sqlite" # Database type
|
||||||
# database = 'sqlite'
|
if 'redis' in database:
|
||||||
if 'sqlite' in database:
|
os.environ['c_not_full'] = "True" # Not full API supported.
|
||||||
os.environ['counter_db_type'] = 'sqlite'
|
os.environ['c_host'] = database.split('://')[-1].split(':')[0]
|
||||||
elif 'mysql' in database:
|
if ':' not in database.split('://'):
|
||||||
os.environ['counter_db_type'] = 'mysql'
|
os.environ['c_port'] = '6379'
|
||||||
|
else:
|
||||||
|
os.environ['c_port'] = database.split('://')[-1].split('@')[0].split(':')[-1]
|
||||||
|
if '@' in database:
|
||||||
|
os.environ['c_password'] = database.split('://')[-1].split(':')[-1].split('@')[-1]
|
||||||
Reference in New Issue
Block a user