summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-03-06 00:30:14 +0100
committerOliver Poignant <oliver@poignant.se>2016-03-06 00:30:14 +0100
commitcfae02619e4bbe56d24da01eb453a83ac73fa3ad (patch)
tree221bde97b49ea88b1bf40e1d4725f226a0a1b1ac /GitAutoDeploy.py
parente457aeeda4ad11daf31c0f176d9e676d657133a4 (diff)
downloadGit-Auto-Deploy-cfae02619e4bbe56d24da01eb453a83ac73fa3ad.zip
Git-Auto-Deploy-cfae02619e4bbe56d24da01eb453a83ac73fa3ad.tar.gz
Git-Auto-Deploy-cfae02619e4bbe56d24da01eb453a83ac73fa3ad.tar.bz2
Added more command line and environment variable options
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-xGitAutoDeploy.py41
1 files changed, 39 insertions, 2 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py
index 12ea71a..335f630 100755
--- a/GitAutoDeploy.py
+++ b/GitAutoDeploy.py
@@ -742,6 +742,10 @@ class GitAutoDeploy(object):
default_config_value = 'GAD_CONFIG' in os.environ and os.environ['GAD_CONFIG']
default_ssh_keygen_value = 'GAD_SSH_KEYGEN' in os.environ
default_force_value = 'GAD_FORCE' in os.environ
+ default_config_value = 'GAD_PID_FILE' in os.environ and os.environ['GAD_PID_FILE']
+ default_config_value = 'GAD_LOG_FILE' in os.environ and os.environ['GAD_LOG_FILE']
+ default_config_value = 'GAD_HOST' in os.environ and os.environ['GAD_HOST']
+ default_config_value = 'GAD_PORT' in os.environ and int(os.environ['GAD_PORT'])
parser = argparse.ArgumentParser()
@@ -756,7 +760,7 @@ class GitAutoDeploy(object):
action="store_true")
parser.add_argument("-c", "--config",
- help="custom configuration file path",
+ help="custom configuration file",
default=default_config_value,
type=str)
@@ -766,10 +770,29 @@ class GitAutoDeploy(object):
action="store_true")
parser.add_argument("--force",
- help="attempt to kill any process that is occupying the configured port",
+ help="kill any process using the configured port",
default=default_force_value,
action="store_true")
+ parser.add_argument("-p", "--pid-file",
+ help="specify a custom pid file",
+ default=default_pid_file_value,
+ type=str)
+
+ parser.add_argument("-l", "--log-file",
+ help="specify a log file",
+ default=default_log_file_value,
+ type=str)
+
+ parser.add_argument("-h", "--host",
+ help="address to bind to",
+ default=default_host_value,
+ type=str)
+
+ parser.add_argument("-p", "--port",
+ help="port to bind to",
+ default=default_port_value,
+
args = parser.parse_args()
# Set up logging
@@ -800,6 +823,20 @@ class GitAutoDeploy(object):
# Read config data from json file
config_data = self.read_json_file(config_file_path)
+ # Configuration options coming from environment or command line will
+ # override those coming from config file
+ if args.pid_file:
+ config_data['pidfilepath'] = args.pid_file:
+
+ if args.log_file:
+ config_data['logfilepath'] = args.log_file:
+
+ if args.host:
+ config_data['host'] = args.host:
+
+ if args.port:
+ config_data['port'] = args.port:
+
# Extend config data with any repository defined by environment variables
config_data = self.read_repo_config_from_environment(config_data)