mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
20 lines
896 B
Text
20 lines
896 B
Text
#!/command/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
# ==============================================================================
|
|
# Home Assistant Community Add-on: Studio Code Server
|
|
# Runs the code-server
|
|
# ==============================================================================
|
|
bashio::log.info 'Starting code-server...'
|
|
|
|
# Export env variables for the Home Assistant extension
|
|
export HASS_SERVER="http://supervisor/core"
|
|
export HASS_TOKEN="${SUPERVISOR_TOKEN:-}"
|
|
|
|
readonly DEFAULT_CONFIG_PATH="/data/vscode"
|
|
readonly CODE_SERVER_WORKSPACE_DIR="$DEFAULT_CONFIG_PATH/workspace"
|
|
readonly CODE_SERVER_WORKSPACE_FILE="$CODE_SERVER_WORKSPACE_DIR/SERVER.code-workspace"
|
|
|
|
# Run the code server
|
|
echo CODE_SERVER_WORKSPACE_FILE "$CODE_SERVER_WORKSPACE_FILE"
|
|
cd "$CODE_SERVER_WORKSPACE_DIR" || bashio::exit.nok "Workspace path does not exist"
|
|
exec code-server "$CODE_SERVER_WORKSPACE_FILE"
|