36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
|
from enum import unique
|
||
|
|
from enum import Enum
|
||
|
|
|
||
|
|
|
||
|
|
@unique
|
||
|
|
class ServerEnv(Enum):
|
||
|
|
DEBUG = 1,
|
||
|
|
BUILD = 2,
|
||
|
|
|
||
|
|
|
||
|
|
class ServerConfig(object):
|
||
|
|
def __init__(self, env: ServerEnv = ServerEnv.DEBUG):
|
||
|
|
super(ServerConfig, self).__init__()
|
||
|
|
self._listen: str = "0.0.0.0"
|
||
|
|
self._listen_port: int = 5000
|
||
|
|
self._env: ServerEnv = env
|
||
|
|
|
||
|
|
self._mysql_host = "192.168.160.223"
|
||
|
|
self._mysql_user = "root"
|
||
|
|
self._mysql_password = "123456"
|
||
|
|
self._mysql_database = "djh_gm"
|
||
|
|
self._mysql_port = 3306
|
||
|
|
self._mysql_character = "UTF8"
|
||
|
|
|
||
|
|
def return_mysql_config(self) -> dict:
|
||
|
|
_mysql_config: dict = {"host": self._mysql_host, "user": self._mysql_user,
|
||
|
|
"password": self._mysql_password, "database": self._mysql_database,
|
||
|
|
"charset": self._mysql_character, "port": self._mysql_port}
|
||
|
|
return _mysql_config
|
||
|
|
|
||
|
|
def tell_listen(self) -> tuple:
|
||
|
|
return self._listen, self._listen_port
|
||
|
|
|
||
|
|
def tell_env(self) -> ServerEnv:
|
||
|
|
return self._env
|