Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions userdocker/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@
],
}

# The following arguments sets default values that can be
# overwritten by the user.
# Do not include these args in ARGS_AVAILABLE or ARGS_ALWAYS
ARGS_DEFAULT = {
'run': {
#'--memory': '50m'
}
}


# Volume mounts:
# - VOLUME_MOUNTS_ALWAYS will be mounted whether the user wants it or not
Expand Down
5 changes: 5 additions & 0 deletions userdocker/helpers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from ..config import ARGS_ALWAYS
from ..config import ARGS_AVAILABLE
from ..config import ARGS_DEFAULT


class _PatchThroughAssignmentAction(argparse._AppendAction):
Expand All @@ -29,6 +30,10 @@ def init_subcommand_parser(parent_parser, scmd):
patch_through_args=[],
)

for arg, val in ARGS_DEFAULT.get(scmd, {}).items():
parser.add_argument(arg, dest="patch_through_args", action=_PatchThroughAssignmentAction)
parser.set_defaults(patch_through_args=parser.get_default('patch_through_args') + [f'{arg}={val}'])

# patch args through
_args_seen = []
for args in ARGS_AVAILABLE.get(scmd, []) + ARGS_ALWAYS.get(scmd, []):
Expand Down