Read ssh_alias and ssh_key from instance.yaml for bootstrap instructions

Config reads server.ssh_alias and server.ssh_key from instance.yaml
(defaults: 'data-analyst' and '~/.ssh/data_analyst_server' for backward compat).
App.py substitutes {ssh_alias} and {ssh_key} in bootstrap.yaml template.
This commit is contained in:
Petr 2026-03-14 21:04:51 +01:00
parent 140cbb3cee
commit 13938bf72f
2 changed files with 4 additions and 0 deletions

View file

@ -820,6 +820,8 @@ def register_routes(app: Flask) -> None:
bootstrap_yaml = bootstrap_yaml_template.replace("{username}", username)
bootstrap_yaml = bootstrap_yaml.replace("{server_host}", Config.SERVER_HOST)
bootstrap_yaml = bootstrap_yaml.replace("{server_hostname}", Config.SERVER_HOSTNAME)
bootstrap_yaml = bootstrap_yaml.replace("{ssh_alias}", Config.SSH_ALIAS)
bootstrap_yaml = bootstrap_yaml.replace("{ssh_key}", Config.SSH_KEY)
webapp_url = f"https://{Config.SERVER_HOSTNAME}" if Config.SERVER_HOSTNAME else ""
bootstrap_yaml = bootstrap_yaml.replace("{webapp_url}", webapp_url)

View file

@ -89,6 +89,8 @@ class Config:
_get(_instance, "server", "host", default=""))
SERVER_HOSTNAME = os.environ.get("SERVER_HOSTNAME",
_get(_instance, "server", "hostname", default=""))
SSH_ALIAS = _get(_instance, "server", "ssh_alias", default="data-analyst")
SSH_KEY = _get(_instance, "server", "ssh_key", default="~/.ssh/data_analyst_server")
# Session config
SESSION_TYPE = "filesystem"