25 lines
622 B
Python
25 lines
622 B
Python
|
import sys
|
||
|
|
||
|
import bottle
|
||
|
|
||
|
from icalendar_timeseries_server.config import load_config, load_default_config, get_config
|
||
|
|
||
|
# Contains decorated bottle handler function for /api/v1/query
|
||
|
# noinspection PyUnresolvedReferences
|
||
|
from icalendar_timeseries_server.api import prometheus_api
|
||
|
|
||
|
|
||
|
def main():
|
||
|
if len(sys.argv) == 1:
|
||
|
load_default_config()
|
||
|
elif len(sys.argv) == 2:
|
||
|
load_config(sys.argv[1])
|
||
|
else:
|
||
|
print(f'Can only read one config file, got "{" ".join(sys.argv[1:])}"')
|
||
|
exit(1)
|
||
|
bottle.run(host=get_config().addr, port=get_config().port)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|