##// END OF EJS Templates
bootstrap: allow setting certain env flags for usage in CLI scripts....
marcink -
r2651:95f21d33 default
parent child
Show More
@@ -68,7 +68,7 def main(ini_path, mode, user, user_id,
68 'of this script.')
68 'of this script.')
69 connection_info = os.environ.get('SSH_CONNECTION', '')
69 connection_info = os.environ.get('SSH_CONNECTION', '')
70
70
71 with bootstrap(ini_path) as env:
71 with bootstrap(ini_path, env={'RC_CMD_SSH_WRAPPER': '1'}) as env:
72 try:
72 try:
73 ssh_wrapper = SshWrapper(
73 ssh_wrapper = SshWrapper(
74 command, connection_info, mode,
74 command, connection_info, mode,
@@ -36,7 +36,9 def get_app_config(ini_path):
36 return appconfig('config:{}'.format(ini_path), relative_to=os.getcwd())
36 return appconfig('config:{}'.format(ini_path), relative_to=os.getcwd())
37
37
38
38
39 def bootstrap(config_uri, request=None, options=None):
39 def bootstrap(config_uri, request=None, options=None, env=None):
40 if env:
41 os.environ.update(env)
40
42
41 config = get_config(config_uri)
43 config = get_config(config_uri)
42 base_url = 'http://rhodecode.local'
44 base_url = 'http://rhodecode.local'
@@ -95,7 +95,7 def command(ini_path, force_yes, user, e
95 dbmanage.populate_default_permissions()
95 dbmanage.populate_default_permissions()
96 Session().commit()
96 Session().commit()
97
97
98 with bootstrap(ini_path) as env:
98 with bootstrap(ini_path, env={'RC_CMD_SETUP_RC': '1'}) as env:
99 msg = 'Successfully initialized database, schema and default data.'
99 msg = 'Successfully initialized database, schema and default data.'
100 print()
100 print()
101 print('*' * len(msg))
101 print('*' * len(msg))
@@ -40,7 +40,7 def main(ini_path, force_yes):
40 def command(ini_path, force_yes):
40 def command(ini_path, force_yes):
41 pyramid.paster.setup_logging(ini_path)
41 pyramid.paster.setup_logging(ini_path)
42
42
43 with bootstrap(ini_path) as env:
43 with bootstrap(ini_path, env={'RC_CMD_UPGRADE_DB': '1'}) as env:
44 config = env['registry'].settings
44 config = env['registry'].settings
45 db_uri = config['sqlalchemy.db1.url']
45 db_uri = config['sqlalchemy.db1.url']
46 options = {}
46 options = {}
General Comments 0
You need to be logged in to leave comments. Login now