Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Cloud9: Adds authentication (#251)
Browse files Browse the repository at this point in the history
* Adds authetication

* Update docs
  • Loading branch information
ludeeus committed Apr 20, 2019
1 parent c3eba09 commit a66c964
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/cloud9.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Description | Command/value
Running as: | homeassistant
Default workspace: | /home/homeassistant/c9workspace/
Default port: | 8181
Default user: | `pi`
Default password: | `raspberry`
Start service: | `sudo systemctl start cloud9@homeassistant.service`
Stop service: | `sudo systemctl stop cloud9@homeassistant.service`
Restart service: | `sudo systemctl restart cloud9@homeassistant.service`
Expand Down
26 changes: 26 additions & 0 deletions package/opt/hassbian/suites/cloud9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ function cloud9-show-copyright-info {
}

function cloud9-install-package {

if [ "$ACCEPT" == "true" ]; then
username=pi
password=raspberry
else
echo
echo "Please take a moment to setup your the user account"
echo

echo -n "Username: "
read -r username
if [ ! "$username" ]; then
username=pi
fi

echo -n "Password: "
read -s -r password
echo
if [ ! "$password" ]; then
password=raspberry
fi
fi

node=$(which node)
if [ -z "${node}" ]; then #Installing NodeJS if not already installed.
printf "Downloading and installing NodeJS...\\n"
Expand Down Expand Up @@ -40,6 +63,9 @@ EOF
echo "Copying Cloud9 service file..."
cp /opt/hassbian/suites/files/cloud9.service /etc/systemd/system/cloud9@homeassistant.service

sed -i "s,%%USERNAME%%,${username},g" /etc/systemd/system/cloud9@homeassistant.service
sed -i "s,%%PASSWORD%%,${password},g" /etc/systemd/system/cloud9@homeassistant.service

echo "Enabling Cloud9 service..."
systemctl enable cloud9@homeassistant.service
sync
Expand Down
2 changes: 1 addition & 1 deletion package/opt/hassbian/suites/files/cloud9.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ After=network-online.target
[Service]
Type=simple
User=homeassistant
ExecStart=/opt/c9sdk/server.js -l 0.0.0.0 -a : -w /home/homeassistant/c9workspace
ExecStart=/opt/c9sdk/server.js -l 0.0.0.0 -a %%USERNAME%%:%%PASSWORD%% -w /home/homeassistant/c9workspace
[Install]
WantedBy=multi-user.target

0 comments on commit a66c964

Please sign in to comment.