Skip to content

Commit 9013484

Browse files
committed
chore: Add runtime config
1 parent 5a189df commit 9013484

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

playground/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NUXT_SESSION_PASSWORD=
2+
NUXT_OAUTH_GITHUB_CLIENT_ID=
3+
NUXT_OAUTH_GITHUB_CLIENT_SECRET=

src/module.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineNuxtModule, addPlugin, createResolver, addImportsDir, addServerImportsDir, addServerHandler } from '@nuxt/kit'
22
import { sha256 } from 'ohash'
3+
import { defu } from 'defu'
34

45
// Module options TypeScript interface definition
56
export interface ModuleOptions {}
@@ -40,5 +41,24 @@ export default defineNuxtModule<ModuleOptions>({
4041
route: '/api/_auth/session',
4142
method: 'get'
4243
})
44+
45+
// Runtime Config
46+
const runtimeConfig = nuxt.options.runtimeConfig
47+
runtimeConfig.session = defu(runtimeConfig.session, {
48+
name: 'nuxt-session',
49+
password: ''
50+
})
51+
// OAuth settings
52+
runtimeConfig.oauth = defu(runtimeConfig.oauth, {})
53+
// GitHub Oauth
54+
runtimeConfig.oauth.github = defu(runtimeConfig.oauth.github, {
55+
clientId: '',
56+
clientSecret: ''
57+
})
58+
// Spotify Oauth
59+
runtimeConfig.oauth.spotify = defu(runtimeConfig.oauth.spotify, {
60+
clientId: '',
61+
clientSecret: ''
62+
})
4363
}
4464
})

0 commit comments

Comments
 (0)