diff --git a/registrar/cli.py b/registrar/cli.py index 567308ff82db4c236ff9984af562e0d48847e1c2..df857e82fe3e738d0f7002a3f5260c6138f08a63 100644 --- a/registrar/cli.py +++ b/registrar/cli.py @@ -61,7 +61,7 @@ def setup_logging(debug=False): @click.group() -@click.option("--config-file", type=click.File("r")) +@click.option("--config-file", type=click.Path(exists=True)) @click.option("--validate", is_flag=True) @click.option("--host", type=str) @click.option("--port", type=int) @@ -77,7 +77,11 @@ def cli( # ensure that ctx.obj exists and is a dict (in case `cli()` is called # by means other than the `if` block below) - config = RegistrarConfig.from_file(config_file, validate) + if not config_file: + raise ValueError("Missing --config-file parameter") + + with open(config_file, encoding="utf-8") as config_file_: + config = RegistrarConfig.from_file(config_file_, validate) if host: config.redis_host = host if port: diff --git a/run-registrar.sh b/run-registrar.sh index b69c27e50ca5bf87f086334b26e9c1c1e96c086d..069213d61ddf53fe37def582840bce6241d86a0a 100755 --- a/run-registrar.sh +++ b/run-registrar.sh @@ -11,13 +11,10 @@ if test "$DEBUG" = true; then debug="--debug" fi -registrar daemon \ - ${debug} \ +registrar \ --config-file /config.yaml \ --host ${REDIS_HOST} \ --port ${REDIS_PORT} \ - --register-queue ${REDIS_REGISTER_QUEUE_KEY} \ - --register-path-queue ${REDIS_REGISTER_PATH_QUEUE_KEY} \ - --deregister-queue ${REDIS_DEREGISTER_QUEUE_KEY} \ - --deregister-path-queue ${REDIS_DEREGISTER_PATH_QUEUE_KEY} \ + ${debug} \ + daemon \ ${replace} >&2