Skip to content

dstack-cloud: sync APP_LAUNCH_TOKEN metadata#13

Open
kvinwang wants to merge 2 commits intomainfrom
kvin/dstack-cloud-app-launch-token
Open

dstack-cloud: sync APP_LAUNCH_TOKEN metadata#13
kvinwang wants to merge 2 commits intomainfrom
kvin/dstack-cloud-app-launch-token

Conversation

@kvinwang
Copy link
Copy Markdown
Collaborator

@kvinwang kvinwang commented Apr 15, 2026

Summary

  • add a shared helper to sync allowed_envs and launch_token_hash from .env
  • update prepare and deploy-time compose generation so APP_LAUNCH_TOKEN works automatically
  • make new generate a default prelaunch.sh template that verifies APP_LAUNCH_TOKEN when present

This can be used to prevent the app from being deployed on an unauthorized device.

Validation

  • python3 -m py_compile scripts/bin/dstack-cloud
  • created a temporary project with dstack-cloud new + prepare and verified generated shared/app-compose.json contains the expected launch_token_hash and allowed_envs

- _apply_env_metadata_to_compose was called twice (once inside
  _generate_app_compose, once at each call site), causing redundant
  allowed_envs processing. Now _generate_app_compose only builds the
  dict; callers apply env metadata in one pass with both envs and
  env_names.
- Remove reboot from prelaunch.sh token check — exit 1 is sufficient
  to block startup; reboot causes an infinite loop if the token stays
  wrong.
- _apply_env_metadata_to_compose now returns None (pure mutation)
  to match how callers use it.
@kvinwang kvinwang requested a review from Leechael April 15, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant