mirror of
https://github.com/Dan6erbond/sk-auth.git
synced 2025-05-07 01:15:31 +02:00
🏷️ Augment ProcessEnv
types and use direct attribute access in place of string access
This commit is contained in:
parent
6f468c659b
commit
e1012d6b91
30
app/src/global.d.ts
vendored
30
app/src/global.d.ts
vendored
@ -1,13 +1,23 @@
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
VITE_GOOGLE_OAUTH_CLIENT_ID: string;
|
||||
VITE_GOOGLE_OAUTH_CLIENT_SECRET: string;
|
||||
VITE_FACEBOOK_OAUTH_CLIENT_ID: string;
|
||||
VITE_FACEBOOK_OAUTH_CLIENT_SECRET: string;
|
||||
VITE_TWITTER_API_KEY: string;
|
||||
VITE_TWITTER_API_SECRET: string;
|
||||
VITE_REDDIT_API_KEY: string;
|
||||
VITE_REDDIT_API_SECRET: string;
|
||||
JWT_SECRET_KEY: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface ImportMetaEnv {}
|
||||
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
GOOGLE_OAUTH_CLIENT_ID: string;
|
||||
GOOGLE_OAUTH_CLIENT_SECRET: string;
|
||||
FACEBOOK_OAUTH_CLIENT_ID: string;
|
||||
FACEBOOK_OAUTH_CLIENT_SECRET: string;
|
||||
TWITTER_API_KEY: string;
|
||||
TWITTER_API_SECRET: string;
|
||||
REDDIT_API_KEY: string;
|
||||
REDDIT_API_SECRET: string;
|
||||
JWT_SECRET_KEY: string;
|
||||
NODE_ENV: "development" | "production";
|
||||
PORT?: string;
|
||||
PWD: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,29 +12,29 @@ dotenv.config();
|
||||
export const appAuth = new SvelteKitAuth({
|
||||
providers: [
|
||||
new GoogleOAuth2Provider({
|
||||
clientId: process.env['VITE_GOOGLE_OAUTH_CLIENT_ID'],
|
||||
clientSecret: process.env['GOOGLE_OAUTH_CLIENT_SECRET'],
|
||||
clientId: process.env.GOOGLE_OAUTH_CLIENT_ID,
|
||||
clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET,
|
||||
profile(profile) {
|
||||
return { ...profile, provider: "google" };
|
||||
},
|
||||
}),
|
||||
new FacebookOAuth2Provider({
|
||||
clientId: process.env['VITE_FACEBOOK_OAUTH_CLIENT_ID'],
|
||||
clientSecret: process.env['FACEBOOK_OAUTH_CLIENT_SECRET'],
|
||||
clientId: process.env.FACEBOOK_OAUTH_CLIENT_ID,
|
||||
clientSecret: process.env.FACEBOOK_OAUTH_CLIENT_SECRET,
|
||||
profile(profile) {
|
||||
return { ...profile, provider: "facebook" };
|
||||
},
|
||||
}),
|
||||
new TwitterAuthProvider({
|
||||
apiKey: process.env['VITE_TWITTER_API_KEY'],
|
||||
apiSecret: process.env['TWITTER_API_SECRET'],
|
||||
apiKey: process.env.TWITTER_API_KEY,
|
||||
apiSecret: process.env.TWITTER_API_SECRET,
|
||||
profile(profile) {
|
||||
return { ...profile, provider: "twitter" };
|
||||
},
|
||||
}),
|
||||
new RedditOAuth2Provider({
|
||||
apiKey: process.env['VITE_REDDIT_API_KEY'],
|
||||
apiSecret: process.env['REDDIT_API_SECRET'],
|
||||
apiKey: process.env.REDDIT_API_KEY,
|
||||
apiSecret: process.env.REDDIT_API_SECRET,
|
||||
profile(profile) {
|
||||
const slim = RedditOAuth2Provider.profileHandler(profile);
|
||||
return { ...slim, provider: "reddit" };
|
||||
@ -57,5 +57,5 @@ export const appAuth = new SvelteKitAuth({
|
||||
return token;
|
||||
},
|
||||
},
|
||||
jwtSecret: process.env['JWT_SECRET_KEY'],
|
||||
jwtSecret: process.env.JWT_SECRET_KEY,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user