-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generates the secrets file before tests start
- Loading branch information
1 parent
3979a83
commit 016a134
Showing
2 changed files
with
21 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
function value_or_empty() { | ||
[ "$1" -eq 1 ] && echo "" || echo "${2}" | ||
} | ||
|
||
SCRIPT_DIR=$(echo "${BASH_SOURCE[0]}" | xargs dirname | xargs -I % sh -c 'cd % && pwd') | ||
PROJECT_ROOT="${SCRIPT_DIR}/.." | ||
SECRETS_FILE="${PROJECT_ROOT}/CouchTrackerApp/Utils/Secrets.swift" | ||
|
||
EMPTY=0; [ "$1" == "empty" ] && EMPTY=1 | ||
|
||
TRAKT_CLIENT_ID=$(value_or_empty "${EMPTY}" "${COUCH_TRACKER_TRAKT_CLIENT_ID}") | ||
TRAKT_CLIENT_SECRET=$(value_or_empty "${EMPTY}" "${COUCH_TRACKER_TRAKT_CLIENT_SECRET}") | ||
TRAKT_REDIRECT_URL=$(value_or_empty "${EMPTY}" "${COUCH_TRACKER_TRAKT_REDIRECT_URL}") | ||
TMDB_API_KEY=$(value_or_empty "${EMPTY}" "${COUCH_TRACKER_TMDB_API_KEY}") | ||
TVDB_API_KEY=$(value_or_empty "${EMPTY}" "${COUCH_TRACKER_TVDB_API_KEY}") | ||
BUGSNAG_KEY=$(value_or_empty "${EMPTY}" "${BUGSNAG_API_KEY}") | ||
|
||
cat > "$SECRETS_FILE" << EOF | ||
enum Secrets { | ||
enum Trakt { | ||
static let clientId = "${COUCH_TRACKER_TRAKT_CLIENT_ID}" | ||
static let clientSecret = "${COUCH_TRACKER_TRAKT_CLIENT_SECRET}" | ||
static let redirectURL = "${COUCH_TRACKER_TRAKT_REDIRECT_URL}" | ||
static let clientId = "${TRAKT_CLIENT_ID}" | ||
static let clientSecret = "${TRAKT_CLIENT_SECRET}" | ||
static let redirectURL = "${TRAKT_REDIRECT_URL}" | ||
} | ||
enum TMDB { | ||
static let apiKey = "${COUCH_TRACKER_TMDB_API_KEY}" | ||
static let apiKey = "${TMDB_API_KEY}" | ||
} | ||
enum TVDB { | ||
static let apiKey = "${COUCH_TRACKER_TVDB_API_KEY}" | ||
static let apiKey = "${TVDB_API_KEY}" | ||
} | ||
enum Bugsnag { | ||
static let apiKey = "${BUGSNAG_API_KEY}" | ||
static let apiKey = "${BUGSNAG_KEY}" | ||
} | ||
} | ||
EOF |