allow specifying the service as env var (#3899)

* allow specifying the service as env var

This is required if running as a Github Action which doesn't allow passing parameters to `docker create` but allows environment variables

* import os

* Update server.py
This commit is contained in:
Razvan Cosma 2021-05-06 16:47:08 +03:00 committed by GitHub
parent e5b3f4181d
commit a268aae540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import argparse
import io
import json
import os
import re
import signal
import sys
@ -262,7 +263,7 @@ def main(argv=sys.argv[1:]):
"service",
type=str,
nargs="?", # http://stackoverflow.com/a/4480202/731592
default=None,
default=os.environ.get("MOTO_SERVICE"),
)
parser.add_argument(
"-H", "--host", type=str, help="Which host to bind", default="127.0.0.1"