forked from Mirrors/elk
refactor: move single instance config to runtime (#1664)
This commit is contained in:
parent
9e09c9072f
commit
2128d11238
6 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
NUXT_PUBLIC_TRANSLATE_API=
|
NUXT_PUBLIC_TRANSLATE_API=
|
||||||
NUXT_PUBLIC_DEFAULT_SERVER=
|
NUXT_PUBLIC_DEFAULT_SERVER=
|
||||||
SINGLE_INSTANCE_SERVER=
|
NUXT_PUBLIC_SINGLE_INSTANCE=
|
||||||
NUXT_PUBLIC_PRIVACY_POLICY_URL=
|
NUXT_PUBLIC_PRIVACY_POLICY_URL=
|
||||||
|
|
||||||
# Production only
|
# Production only
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
|
|
||||||
export const useSignIn = (input?: Ref<HTMLInputElement | undefined>) => {
|
export const useSignIn = (input?: Ref<HTMLInputElement | undefined>) => {
|
||||||
const singleInstanceServer = useAppConfig().singleInstanceServer
|
const singleInstanceServer = useRuntimeConfig().public.singleInstance
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
const users = useUsers()
|
const users = useUsers()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
|
@ -45,7 +45,7 @@ There are 5 environment variables to add.
|
||||||
| NUXT_CLOUDFLARE_NAMESPACE_ID | This is your CloudFlare KV Namespace ID. You can find it in "Workers > KV". |
|
| NUXT_CLOUDFLARE_NAMESPACE_ID | This is your CloudFlare KV Namespace ID. You can find it in "Workers > KV". |
|
||||||
| NUXT_STORAGE_DRIVER | Because we're using CloudFlare, we'll need to set this to `cloudflare`. |
|
| NUXT_STORAGE_DRIVER | Because we're using CloudFlare, we'll need to set this to `cloudflare`. |
|
||||||
| NUXT_PUBLIC_DEFAULT_SERVER | This is the address of the Mastodon instance that will show up when a user visits your Elk deployment and is not logged in. If you don't make that variable, it will point to `m.webtoo.ls` by default. |
|
| NUXT_PUBLIC_DEFAULT_SERVER | This is the address of the Mastodon instance that will show up when a user visits your Elk deployment and is not logged in. If you don't make that variable, it will point to `m.webtoo.ls` by default. |
|
||||||
| SINGLE_INSTANCE_SERVER | This can't be set at runtime, but if enabled at build-time it will disable signing in to servers other than the server specified in `NUXT_PUBLIC_DEFAULT_SERVER` |
|
| NUXT_PUBLIC_SINGLE_INSTANCE | If enabled it will disable signing in to servers other than the server specified in `NUXT_PUBLIC_DEFAULT_SERVER` |
|
||||||
| NUXT_PUBLIC_PRIVACY_POLICY_URL | This is the URL to a web page with information on your privacy policy. |
|
| NUXT_PUBLIC_PRIVACY_POLICY_URL | This is the URL to a web page with information on your privacy policy. |
|
||||||
|
|
||||||
That's it! All that's left to do is...
|
That's it! All that's left to do is...
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||||
return
|
return
|
||||||
|
|
||||||
// Handle redirecting to new permalink structure for users with old links
|
// Handle redirecting to new permalink structure for users with old links
|
||||||
if (!useAppConfig().singleInstanceServer && !to.params.server) {
|
if (!useRuntimeConfig().public.singleInstance && !to.params.server) {
|
||||||
return {
|
return {
|
||||||
...to,
|
...to,
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default defineNuxtRouteMiddleware(async (to) => {
|
export default defineNuxtRouteMiddleware(async (to) => {
|
||||||
if (process.server || !useAppConfig().singleInstanceServer)
|
if (process.server || !useRuntimeConfig().public.singleInstance)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (to.params.server) {
|
if (to.params.server) {
|
||||||
|
|
|
@ -96,7 +96,6 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
appConfig: {
|
appConfig: {
|
||||||
singleInstanceServer: process.env.SINGLE_INSTANCE_SERVER === 'true',
|
|
||||||
storage: {
|
storage: {
|
||||||
driver: process.env.NUXT_STORAGE_DRIVER ?? (isCI ? 'cloudflare' : 'fs'),
|
driver: process.env.NUXT_STORAGE_DRIVER ?? (isCI ? 'cloudflare' : 'fs'),
|
||||||
},
|
},
|
||||||
|
@ -115,6 +114,7 @@ export default defineNuxtConfig({
|
||||||
translateApi: '',
|
translateApi: '',
|
||||||
// Use the instance where Elk has its Mastodon account as the default
|
// Use the instance where Elk has its Mastodon account as the default
|
||||||
defaultServer: 'm.webtoo.ls',
|
defaultServer: 'm.webtoo.ls',
|
||||||
|
singleInstance: false,
|
||||||
},
|
},
|
||||||
storage: {
|
storage: {
|
||||||
fsBase: 'node_modules/.cache/app',
|
fsBase: 'node_modules/.cache/app',
|
||||||
|
|
Loading…
Reference in a new issue