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