config.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:sshchan 作者: einchan 项目源码 文件源码
def __init__(self, cfg_path=""):
        # Find config file.

        self.path = self.look_for_config(
            cfg_path,
            os.getcwd() + "/sshchan.conf",
            os.getenv('HOME', default="~") + "/sshchan.conf",
            "/etc/sshchan.conf")

        self.root = self.get_cfg_opt("rootdir", "/srv/sshchan", fatal=True)
        self.boardlist_path = self.get_cfg_opt(
            "boardlist_path", self.root + "/boardlist")
        self.postnums_path = self.get_cfg_opt(
            "postnums_path", self.root + "/postnums")
        self.version = self.get_cfg_opt("version", "0.0")
        self.motd = self.get_cfg_opt("motd_path", "/etc/motd")
        self.server_name = self.get_cfg_opt("name", "an sshchan server")
        self.username = os.getenv("USERNAME", default="anonymous")
        self.max_boards = 10  # How many boards can be displayed in top bar.
        self.display_legacy = self.get_cfg_opt("display_legacy", "False")
        self.prompt = self.get_cfg_opt("prompt", "sshchan")
        # self.admin = settings["admin"]
        # self.salt = settings["salt"]
        # self.passwd = settings["password"]

        # Max threads on page.
        self.max_threads = 14
        # Terminal size.
        self.tty_cols = os.get_terminal_size()[0]
        self.tty_lines = os.get_terminal_size()[1]
        # Used for laprint() from Display.
        self.lines_printed = 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号