1#!/bin/bash
2
3set -e
4
5if [[ -z "$GITHUB_TOKEN" ]]; then
6 cat <<-MESSAGE
7Missing \`GITHUB_TOKEN\` environment variable. This token is needed
8for fetching your GitHub identity from the command-line.
9
10Create an access token here: https://github.com/settings/tokens
11Then edit your \`~/.zshrc\` (or other shell initialization script),
12adding a line like this:
13
14 export GITHUB_TOKEN="(the token)"
15
16MESSAGE
17 exit 1
18fi
19
20github_login=$(curl -sH "Authorization: bearer $GITHUB_TOKEN" https://api.github.com/user | jq -r .login)
21
22other_github_login=nathansobo
23if [[ $github_login == $other_github_login ]]; then
24 other_github_login=as-cii
25fi
26
27export ZED_ADMIN_API_TOKEN=secret
28export ZED_SERVER_URL=http://localhost:8080
29
30trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
31ZED_IMPERSONATE=${github_login} cargo run --quiet $@ &
32ZED_IMPERSONATE=${other_github_login} cargo run --quiet &
33wait