#!/bin/bash

#
# Install Code Server
#

mkdir -p  /root/.config/code-server/
curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/main/instance-scripts/config-files/config.yaml -o root/.config/code-server/config.yaml
sed -i "s/%user_password%/$(scw-userdata user_password)/g" /root/.config/code-server/config.yaml
curl -fsSL https://code-server.dev/install.sh | sh

#
# Run Code Server
#

sudo systemctl enable --now code-server@$USER