~huyngo/gh-migrate

ref: 68741f943974f49e3fa5ec90a14fd8e600464f50 gh-migrate/config.py -rw-r--r-- 540 bytes
68741f94Ngô Ngọc Đức Huy Add some draft 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json


class APIConfig:
    user: str
    repo: str
    rate_limit: int
    page_length: int
    token: str

    def __init__(self, config: dict):
        self.user = config['user']
        self.repo = config['repo']
        self.rate_limit = config['rate_limit']
        self.page_length = config['page_length']
        self.token = config['token']


def get_config(forge: str) -> APIConfig:
    """Get config for relevant forge."""
    with open('config.json', 'r') as f:
        config = json.dump(f)
        return config[forge]