2022-12-22 14:18:43 +00:00
|
|
|
from configparser import RawConfigParser
|
|
|
|
from typing import Union
|
|
|
|
from distutils.util import strtobool
|
|
|
|
|
|
|
|
# [pyrogram]
|
|
|
|
api_id: int = 0
|
|
|
|
api_hash: str = ""
|
|
|
|
# [Basic]
|
|
|
|
ipv6: Union[bool, str] = "False"
|
2023-07-21 14:00:49 +00:00
|
|
|
cache_uri: str = "mem://"
|
2022-12-22 14:18:43 +00:00
|
|
|
# [misskey]
|
2023-01-27 12:36:41 +00:00
|
|
|
web_domain: str = ""
|
2022-12-22 14:18:43 +00:00
|
|
|
admin: int = 0
|
|
|
|
|
|
|
|
config = RawConfigParser()
|
|
|
|
config.read("config.ini")
|
|
|
|
api_id = config.getint("pyrogram", "api_id", fallback=api_id)
|
|
|
|
api_hash = config.get("pyrogram", "api_hash", fallback=api_hash)
|
|
|
|
ipv6 = config.get("basic", "ipv6", fallback=ipv6)
|
2023-07-21 14:00:49 +00:00
|
|
|
cache_uri = config.get("basic", "cache_uri", fallback=cache_uri)
|
2023-01-27 12:36:41 +00:00
|
|
|
web_domain = config.get("misskey", "web_domain", fallback=web_domain)
|
2022-12-22 14:18:43 +00:00
|
|
|
admin = config.getint("misskey", "admin", fallback=admin)
|
|
|
|
try:
|
2023-07-20 14:21:37 +00:00
|
|
|
ipv6 = bool(strtobool(ipv6))
|
2022-12-22 14:18:43 +00:00
|
|
|
except ValueError:
|
|
|
|
ipv6 = False
|