setup .env file by version
This commit is contained in:
parent
d94653eb70
commit
fc7846c55c
15
alakazam.py
15
alakazam.py
|
@ -205,13 +205,13 @@ def write_env_header(path):
|
|||
file.write(header + old_content)
|
||||
|
||||
|
||||
def new_app(recipe, domain, server):
|
||||
def new_app(recipe, domain, server, version):
|
||||
path = get_env_path(server, domain)
|
||||
if path.exists():
|
||||
print(f'remove {path}')
|
||||
path.unlink()
|
||||
logging.info(f'create {recipe} config on {server} at {domain}')
|
||||
out = abra("app", "new", recipe, "-n", "-s", server, "-D", domain)
|
||||
out = abra("app", "new", recipe, "-n", "-s", server, "-D", domain, version)
|
||||
if not "app has been created" in out:
|
||||
raise RuntimeError(f'App "{recipe}" creation failed')
|
||||
else:
|
||||
|
@ -434,12 +434,6 @@ def cli(loglevel, pool_path, config_path):
|
|||
logging.basicConfig(level=numeric_level)
|
||||
|
||||
|
||||
#@cli.command()
|
||||
#def init_server():
|
||||
# """ Initialize the server """
|
||||
# new_app("traefik")
|
||||
# new_app("backup-bot-two")
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--apps', multiple=True)
|
||||
def setup(apps):
|
||||
|
@ -466,8 +460,9 @@ def config(apps):
|
|||
domain = app_config['app_domain']
|
||||
server = app_config["server"]
|
||||
path = get_env_path(server, domain)
|
||||
print(f'Setup {app} config on {server} at {domain}')
|
||||
new_app(app, domain, server)
|
||||
version = app_config.get('version')
|
||||
print(f'Setup {app} ({version}) config on {server} at {domain}')
|
||||
new_app(app, domain, server, version)
|
||||
logging.info(f'set configs for {app} at {instance}')
|
||||
update_configs(path, app_config)
|
||||
exchange_domains(instance, instance_config, path)
|
||||
|
|
Loading…
Reference in New Issue