@dataroadinc/setup-auth
Version:
CLI tool and programmatic API for automated OAuth setup across cloud platforms
25 lines (24 loc) • 890 B
JavaScript
import { GCP_OAUTH_ALLOWED_DOMAINS, GCP_OAUTH_CLIENT_ID, GCP_OAUTH_CLIENT_SECRET, } from "../../../utils/env-handler.js";
export async function checkExistingOAuthSettings() {
const result = {
hasClientId: false,
hasClientSecret: false,
hasAllowedDomains: false,
clientId: undefined,
clientSecret: undefined,
allowedDomains: undefined,
};
if (process.env[GCP_OAUTH_CLIENT_ID]) {
result.hasClientId = true;
result.clientId = process.env[GCP_OAUTH_CLIENT_ID];
}
if (process.env[GCP_OAUTH_CLIENT_SECRET]) {
result.hasClientSecret = true;
result.clientSecret = process.env[GCP_OAUTH_CLIENT_SECRET];
}
if (process.env[GCP_OAUTH_ALLOWED_DOMAINS]) {
result.hasAllowedDomains = true;
result.allowedDomains = process.env[GCP_OAUTH_ALLOWED_DOMAINS];
}
return result;
}