nonebot2/nonebot/config.py

38 lines
792 B
Python
Raw Normal View History

2020-07-04 22:51:10 +08:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ipaddress import IPv4Address
2020-08-01 22:03:40 +08:00
from typing import Set, Dict, Union, Optional
2020-07-04 22:51:10 +08:00
from pydantic import BaseSettings
class Env(BaseSettings):
environment: str = "prod"
class Config:
env_file = ".env"
class Config(BaseSettings):
2020-08-01 22:03:40 +08:00
# nonebot configs
2020-07-04 22:51:10 +08:00
driver: str = "nonebot.drivers.fastapi"
host: IPv4Address = IPv4Address("127.0.0.1")
port: int = 8080
2020-08-01 22:03:40 +08:00
secret: Optional[str] = None
2020-07-04 22:51:10 +08:00
debug: bool = False
2020-08-01 22:03:40 +08:00
# bot connection configs
api_root: Dict[int, str] = {}
access_token: Optional[str] = None
# bot runtime configs
2020-07-04 22:51:10 +08:00
superusers: Set[int] = set()
nickname: Union[str, Set[str]] = ""
2020-08-01 22:03:40 +08:00
# custom configs
2020-07-04 22:51:10 +08:00
custom_config: dict = {}
class Config:
env_file = ".env.prod"