Skip to content

Commit d2f3e73

Browse files
authored
Merge pull request #124 from zkanda/add-variables-as-shell-parameter
Added --variables as arguments
2 parents a8492af + b52cac9 commit d2f3e73

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lambda_uploader/config.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434

3535

3636
class Config(object):
37-
def __init__(self, pth, config_file=None, role=None):
37+
def __init__(self, pth, config_file=None, role=None, variables=None):
3838
self._path = pth
3939
self._config = None
4040
self._load_config(config_file)
4141
if role is not None:
4242
self._config['role'] = role
43+
if variables is not None:
44+
self._config['variables'] = json.loads(variables)
4345
self._set_defaults()
4446
if self._config['vpc']:
4547
self._validate_vpc()

lambda_uploader/shell.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def _print(txt):
4747
def _execute(args):
4848
pth = path.abspath(args.function_dir)
4949

50-
cfg = config.Config(pth, args.config, role=args.role)
50+
cfg = config.Config(pth, args.config, role=args.role,
51+
variables=args.variables)
5152

5253
if args.s3_bucket:
5354
cfg.set_s3(args.s3_bucket, args.s3_key)
@@ -140,6 +141,8 @@ def main(arv=None):
140141
default=getenv('LAMBDA_UPLOADER_ROLE'),
141142
help=('IAM role to assign the lambda function, '
142143
'can be set with $LAMBDA_UPLOADER_ROLE'))
144+
parser.add_argument('--variables', dest='variables',
145+
help='add environment variables')
143146
parser.add_argument('--profile', dest='profile',
144147
help='specify AWS cli profile')
145148
parser.add_argument('--requirements', '-r', dest='requirements',

0 commit comments

Comments
 (0)