3 from dataclasses import dataclass
6 from typing import Optional
10 logger = logging.getLogger(__name__)
11 args = config.add_commandline_args(
13 'Args related to __file__'
17 '--site_config_location',
21 choices=('HOUSE', 'CABIN', 'AUTO'),
22 help='Where are we, HOUSE or CABIN?'
27 class SiteConfig(object):
30 network_router_ip: str
34 location = config.config['site_config_location']
35 if location == 'AUTO':
36 hostname = platform.node()
37 if '.house' in hostname:
39 elif '.cabin' in hostname:
42 raise Exception(f'Unknown hostname {hostname}, help.')
47 location = get_location()
48 if location == 'HOUSE':
50 network = '10.0.0.0/24',
51 network_netmask = '255.255.255.0',
52 network_router_ip = '10.0.0.1',
54 elif location == 'CABIN':
56 network = '192.168.0.0/24',
57 network_netmask = '255.255.255.0',
58 network_router_ip = '192.168.0.1',
61 raise Exception('Unknown site location')