Make project_dir, ssh_key configurable in Get Started UI

Read server.project_dir from instance.yaml (default: 'data-analyst').
Replace hardcoded 'data-analyst' folder name and 'data_analyst_server'
SSH key name in dashboard template with Jinja variables.
This commit is contained in:
Petr 2026-03-15 00:12:46 +01:00
parent 021c453ea6
commit 3ebb15cbab
3 changed files with 10 additions and 7 deletions

View file

@ -822,6 +822,7 @@ def register_routes(app: Flask) -> None:
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)
bootstrap_yaml = bootstrap_yaml.replace("{project_dir}", Config.PROJECT_DIR)
webapp_url = f"https://{Config.SERVER_HOSTNAME}" if Config.SERVER_HOSTNAME else ""
bootstrap_yaml = bootstrap_yaml.replace("{webapp_url}", webapp_url)
@ -874,6 +875,7 @@ def register_routes(app: Flask) -> None:
server_hostname=Config.SERVER_HOSTNAME,
ssh_alias=Config.SSH_ALIAS,
ssh_key=Config.SSH_KEY,
project_dir=Config.PROJECT_DIR,
bootstrap_yaml=bootstrap_yaml,
telegram_status=telegram_status,
desktop_status=desktop_status,

View file

@ -91,6 +91,7 @@ class Config:
_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")
PROJECT_DIR = _get(_instance, "server", "project_dir", default="data-analyst")
# Session config
SESSION_TYPE = "filesystem"

View file

@ -1878,7 +1878,7 @@
<h3>Set up your local environment</h3>
<p class="env-subtitle">Run Claude Code in your project folder and paste the setup instructions to configure SSH, sync data, and initialize DuckDB.</p>
<div class="env-setup-row">
<span class="code-pill">cd data-analyst && claude</span>
<span class="code-pill">cd {{ project_dir }} && claude</span>
<button onclick="copyBootstrapInstructions(this)" class="btn-setup" id="bootstrapCopyBtn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
@ -2321,18 +2321,18 @@
<div class="terminal-lines">
<div class="terminal-line">
<span class="prompt">$</span>
<span class="cmd">mkdir -p data-analyst && cd data-analyst</span>
<button onclick="copyTermLine(this, 'mkdir -p data-analyst && cd data-analyst')" class="btn-copy-term">copy</button>
<span class="cmd">mkdir -p {{ project_dir }} && cd {{ project_dir }}</span>
<button onclick="copyTermLine(this, 'mkdir -p {{ project_dir }} && cd {{ project_dir }}')" class="btn-copy-term">copy</button>
</div>
<div class="terminal-line">
<span class="prompt">$</span>
<span class="cmd">ssh-keygen -t ed25519 -f ~/.ssh/data_analyst_server -N ''</span>
<button onclick="copyTermLine(this, &quot;ssh-keygen -t ed25519 -f ~/.ssh/data_analyst_server -N ''&quot;)" class="btn-copy-term">copy</button>
<span class="cmd">ssh-keygen -t ed25519 -f {{ ssh_key }} -N ''</span>
<button onclick="copyTermLine(this, &quot;ssh-keygen -t ed25519 -f {{ ssh_key }} -N ''&quot;)" class="btn-copy-term">copy</button>
</div>
<div class="terminal-line">
<span class="prompt">$</span>
<span class="cmd">cat ~/.ssh/data_analyst_server.pub</span>
<button onclick="copyTermLine(this, 'cat ~/.ssh/data_analyst_server.pub')" class="btn-copy-term">copy</button>
<span class="cmd">cat {{ ssh_key }}.pub</span>
<button onclick="copyTermLine(this, 'cat {{ ssh_key }}.pub')" class="btn-copy-term">copy</button>
</div>
<div class="terminal-line">
<span class="comment"># Copy the output above and paste it below</span>