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_PASSWORD=# openssl rand -base64 32
NUXT_S3_BUCKET=pichunt
NUXT_S3_HOST=s3.swarm.syma.dev
NUXT_PUBLIC_S3_BUCKET=pichunt
NUXT_PUBLIC_S3_HOST=s3.swarm.syma.dev
NUXT_S3_ACCESS_KEY=access_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')
})
);
const { s3Bucket, s3Host } = useRuntimeConfig().public;
</script>
<template>
<Html
@@ -28,6 +30,8 @@ const title = computed(() =>
:hreflang="link.hreflang"
/>
</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">
<Meta :id="meta.id" :property="meta.property" :content="meta.content" />
</template>
Vendored
+4 -2
View File
@@ -1,10 +1,12 @@
declare module 'nuxt/schema' {
interface RuntimeConfig {
s3Bucket: string;
s3Host: string;
s3AccessKey: string;
s3SecretKey: string;
}
interface PublicRuntimeConfig {
s3Bucket: string;
s3Host: string;
}
}
// It is always important to ensure you import/export something when augmenting a type
export {};
+5 -2
View File
@@ -2,8 +2,11 @@ import { Client } from 'minio';
// TODO: add docker secret parsing
export const { s3Bucket, s3Host, s3AccessKey, s3SecretKey } =
useRuntimeConfig();
export const {
public: { s3Bucket, s3Host },
s3AccessKey,
s3SecretKey
} = useRuntimeConfig();
export const minioClient = new Client({
endPoint: s3Host,
+4 -2
View File
@@ -12,8 +12,10 @@ export default defineNuxtConfig({
'@pinia/nuxt'
],
runtimeConfig: {
s3Bucket: 'pichunt',
s3Host: 's3.swarm.syma.dev',
public: {
s3Bucket: 'pichunt',
s3Host: 's3.swarm.syma.dev'
},
s3AccessKey: 'user',
s3SecretKey: 'password'
},