Add s3 endpoint as preload

This commit is contained in:
2025-08-02 01:18:37 +02:00
parent 7d974a857c
commit facb07de5b
5 changed files with 19 additions and 8 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ REDIS_PORT=6379
NUXT_REDIS_HOST=redis NUXT_REDIS_HOST=redis
NUXT_REDIS_PASSWORD=# openssl rand -base64 32 NUXT_REDIS_PASSWORD=# openssl rand -base64 32
NUXT_S3_BUCKET=pichunt NUXT_PUBLIC_S3_BUCKET=pichunt
NUXT_S3_HOST=s3.swarm.syma.dev NUXT_PUBLIC_S3_HOST=s3.swarm.syma.dev
NUXT_S3_ACCESS_KEY=access_key NUXT_S3_ACCESS_KEY=access_key
NUXT_S3_SECRET_KEY=secret_key NUXT_S3_SECRET_KEY=secret_key
+4
View File
@@ -12,6 +12,8 @@ const title = computed(() =>
title: t((route.meta.title as string) || 'layouts.default_tile') title: t((route.meta.title as string) || 'layouts.default_tile')
}) })
); );
const { s3Bucket, s3Host } = useRuntimeConfig().public;
</script> </script>
<template> <template>
<Html <Html
@@ -28,6 +30,8 @@ const title = computed(() =>
:hreflang="link.hreflang" :hreflang="link.hreflang"
/> />
</template> </template>
<Link rel="dns-prefetch" :href="`https://${s3Bucket}.${s3Host}/`" />
<Link rel="preconnect" :href="`https://${s3Bucket}.${s3Host}/`" />
<template v-for="meta in head.meta" :key="meta.id"> <template v-for="meta in head.meta" :key="meta.id">
<Meta :id="meta.id" :property="meta.property" :content="meta.content" /> <Meta :id="meta.id" :property="meta.property" :content="meta.content" />
</template> </template>
Vendored
+4 -2
View File
@@ -1,10 +1,12 @@
declare module 'nuxt/schema' { declare module 'nuxt/schema' {
interface RuntimeConfig { interface RuntimeConfig {
s3Bucket: string;
s3Host: string;
s3AccessKey: string; s3AccessKey: string;
s3SecretKey: string; s3SecretKey: string;
} }
interface PublicRuntimeConfig {
s3Bucket: string;
s3Host: string;
}
} }
// It is always important to ensure you import/export something when augmenting a type // It is always important to ensure you import/export something when augmenting a type
export {}; export {};
+5 -2
View File
@@ -2,8 +2,11 @@ import { Client } from 'minio';
// TODO: add docker secret parsing // TODO: add docker secret parsing
export const { s3Bucket, s3Host, s3AccessKey, s3SecretKey } = export const {
useRuntimeConfig(); public: { s3Bucket, s3Host },
s3AccessKey,
s3SecretKey
} = useRuntimeConfig();
export const minioClient = new Client({ export const minioClient = new Client({
endPoint: s3Host, endPoint: s3Host,
+4 -2
View File
@@ -12,8 +12,10 @@ export default defineNuxtConfig({
'@pinia/nuxt' '@pinia/nuxt'
], ],
runtimeConfig: { runtimeConfig: {
s3Bucket: 'pichunt', public: {
s3Host: 's3.swarm.syma.dev', s3Bucket: 'pichunt',
s3Host: 's3.swarm.syma.dev'
},
s3AccessKey: 'user', s3AccessKey: 'user',
s3SecretKey: 'password' s3SecretKey: 'password'
}, },