From a268aae540a040fe14ba4627a174050f220834e2 Mon Sep 17 00:00:00 2001 From: Razvan Cosma <75040720+razvan-moj@users.noreply.github.com> Date: Thu, 6 May 2021 16:47:08 +0300 Subject: [PATCH] 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 --- moto/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moto/server.py b/moto/server.py index 748cd2974..338ca9db3 100644 --- a/moto/server.py +++ b/moto/server.py @@ -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"