mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-15 10:07:55 +08:00
* Update client keys to use environment vars * Extra logging to assist with debugging * Add other files to test target (temporary solution) * Update Project Target References * Add arguments and share scheme * Disable failing FBSnapshot tests * If at first you fail, wait 20 minutes for a build and then try again * Update test to also ensure it's not using the template keys * Update gitignore * Remove intentional failing test * revert pod changes * revert podfile
42 lines
1.0 KiB
Swift
42 lines
1.0 KiB
Swift
//
|
|
// Secrets.swift
|
|
// Freetime
|
|
//
|
|
// Created by Sherlock, James on 23/11/2017.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
enum Secrets {
|
|
|
|
enum CI {
|
|
static let githubId = "{GITHUBID}"
|
|
static let githubSecret = "{GITHUBSECRET}"
|
|
static let imgurId = "{IMGURID}"
|
|
}
|
|
|
|
enum GitHub {
|
|
static let clientId = Secrets.environmentVariable(named: "GITHUB_CLIENT_ID") ?? CI.githubId
|
|
static let clientSecret = Secrets.environmentVariable(named: "GITHUB_CLIENT_SECRET") ?? CI.githubSecret
|
|
}
|
|
|
|
enum Imgur {
|
|
static let clientId = Secrets.environmentVariable(named: "IMGUR_CLIENT_ID") ?? CI.imgurId
|
|
}
|
|
|
|
fileprivate static func environmentVariable(named: String) -> String? {
|
|
|
|
let processInfo = ProcessInfo.processInfo
|
|
|
|
guard let value = processInfo.environment[named] else {
|
|
print("‼️ Missing Environment Variable: '\(named)'")
|
|
return nil
|
|
}
|
|
|
|
return value
|
|
|
|
}
|
|
|
|
}
|