#!/bin/bash

set -euo pipefail

CINDER_SECRET__ARTIFACTORY_DOCKER_TOKEN=$(vault read -field=value secret/cinder/artifactory_docker_token)
CINDER_SECRET__AWS_ACCESS_KEY_ID=$(vault read -field=id secret/cinder/aws_access_key)
CINDER_SECRET__AWS_SECRET_ACCESS_KEY=$(vault read -field=secret_key secret/cinder/aws_access_key)
CINDER_SECRET__BAMBOO_PASSWORD=$(vault read -field=password secret/cinder/bamboo)
CINDER_SECRET__BAMBOO_USER=$(vault read -field=user secret/cinder/bamboo)
CINDER_SECRET__CCBOT_SLACK_TOKEN=$(vault read -field=value secret/cinder/ccbot_slack_token)
CINDER_SECRET__GITHUB_SSH_PRIVATE_KEY=$(vault read -field=private_key secret/cinder/github_ssh_key)
CINDER_SECRET__GITHUB_TOKEN=$(vault read -field=value secret/cinder/github_token)
CINDER_SECRET__GITHUB_WEBHOOK_SECRET=$(vault read -field=value secret/cinder/github_webhook_secret)
CINDER_SECRET__PMAV_SLACK_TOKEN=$(vault read -field=value secret/cinder/pmav_slack_token)
CINDER_SECRET__SLACK_TOKEN=$(vault read -field=value secret/cinder/slack_token)
CINDER_SECRET__ZOOX_JARS_AWS_ACCESS_KEY_ID=$(vault read -field=value secret/cinder/zoox_jars_aws_access_key_id)
CINDER_SECRET__ZOOX_JARS_AWS_SECRET_ACCESS_KEY=$(vault read -field=value secret/cinder/zoox_jars_aws_secret_access_key)

export CINDER_SECRET__ARTIFACTORY_DOCKER_TOKEN
export CINDER_SECRET__AWS_ACCESS_KEY_ID
export CINDER_SECRET__AWS_SECRET_ACCESS_KEY
export CINDER_SECRET__BAMBOO_PASSWORD
export CINDER_SECRET__BAMBOO_USER
export CINDER_SECRET__CCBOT_SLACK_TOKEN
export CINDER_SECRET__GITHUB_SSH_PRIVATE_KEY
export CINDER_SECRET__GITHUB_TOKEN
export CINDER_SECRET__GITHUB_WEBHOOK_SECRET
export CINDER_SECRET__PMAV_SLACK_TOKEN
export CINDER_SECRET__SLACK_TOKEN
export CINDER_SECRET__ZOOX_JARS_AWS_ACCESS_KEY_ID
export CINDER_SECRET__ZOOX_JARS_AWS_SECRET_ACCESS_KEY

"$@"
