#!/usr/bin/env python3
"""
Start granian with the options listed in /openedx/granian-config.

Granian has no config file support and only accepts command-line options, so
this wrapper converts the file into an argument list, one option per line,
with environment variables expanded.
"""

import os
import shlex

from granian.cli import cli

if __name__ == "__main__":
    with open("/openedx/granian-config", encoding="utf-8") as f:
        args = shlex.split(os.path.expandvars(f.read()), comments=True)
    cli(args=args)
