#!/bin/bash
if [[ -n "$SSH_PUBLIC_KEY" && -n "$SSH_PRIVATE_KEY" ]]; then
    echo "ADDING SSH KEYS!"
    SSH_DIR="/home/$(whoami)/.ssh"
    mkdir -p $SSH_DIR

    echo "$SSH_PUBLIC_KEY" > $SSH_DIR/id_rsa.pub
    echo "$SSH_PRIVATE_KEY" > $SSH_DIR/id_rsa
cat << EOF > $SSH_DIR/config
Host *
    StrictHostKeyChecking no
EOF

    chmod 600 $SSH_DIR/id_rsa
    chmod 644 $SSH_DIR/id_rsa.pub
    cat $SSH_DIR/config
fi