Fix Dockerization

This commit is contained in:
2025-07-15 14:09:42 +02:00
parent 2639a5301a
commit d9acd72d7b
13 changed files with 154 additions and 66 deletions

View File

@@ -1,9 +1,7 @@
import axios from "axios";
import {userManager} from "../stores/auth.ts";
const axiosInstance = axios.create({
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8080'
})
const axiosInstance = axios.create()
axiosInstance.interceptors.request.use(async (config) => {
const user = await userManager.getUser()

View File

@@ -10,7 +10,8 @@ import {
AccordionContent,
AccordionHeader,
AccordionPanel,
DatePicker, Fluid,
DatePicker,
Fluid,
ToastService
} from "primevue";
import {createPinia} from "pinia";
@@ -26,6 +27,15 @@ import axiosInstance from "./api";
import SetsView from "./views/set/SetsView.vue";
import JobsView from "./views/JobsView.vue";
import {definePreset} from "@primeuix/themes";
import {getConfig, initConfig} from "@/util/config.ts";
// Initialize configuration from window object
initConfig((window as any).__APP_CONFIG__ || {})
// Use the config in your app
const config = getConfig()
console.log('API Base URL:', config.API_BASE_URL)
export const DeckServiceKey = Symbol("deckServiceKey")
export const CardServiceKey = Symbol("cardServiceKey")
@@ -134,11 +144,11 @@ router.beforeEach(async (to) => {
app.use(router);
app.use(ToastService)
const deckService: DeckService = new DeckService(undefined, "http://localhost:8080", axiosInstance)
const cardService: CardService = new CardService(undefined, "http://localhost:8080", axiosInstance)
const setService: SetService = new SetService(undefined, "http://localhost:8080", axiosInstance)
const cardPrintService: CardPrintService = new CardPrintService(undefined, "http://localhost:8080", axiosInstance)
const jobService: JobService = new JobService(undefined, "http://localhost:8080", axiosInstance)
const deckService: DeckService = new DeckService(undefined, config.API_BASE_URL, axiosInstance)
const cardService: CardService = new CardService(undefined, config.API_BASE_URL, axiosInstance)
const setService: SetService = new SetService(undefined, config.API_BASE_URL, axiosInstance)
const cardPrintService: CardPrintService = new CardPrintService(undefined, config.API_BASE_URL, axiosInstance)
const jobService: JobService = new JobService(undefined, config.API_BASE_URL, axiosInstance)
app.provide(DeckServiceKey, deckService)
app.provide(CardServiceKey, cardService)

View File

@@ -1,19 +0,0 @@
import darkAttribute from "/src/assets/DARK.svg"
import divineAttribute from "/src/assets/DIVINE.svg"
import earthAttribute from "/src/assets/EARTH.svg"
import fireAttribute from "/src/assets/FIRE.svg"
import laughAttribute from "/src/assets/LAUGH.svg"
import lightAttribute from "/src/assets/LIGHT.svg"
import waterAttribute from "/src/assets/WATER.svg"
import windAttribute from "/src/assets/WIND.svg"
export {
darkAttribute,
divineAttribute,
earthAttribute,
fireAttribute,
laughAttribute,
lightAttribute,
waterAttribute,
windAttribute
}

24
src/util/config.ts Normal file
View File

@@ -0,0 +1,24 @@
// Define your config interface
export interface AppConfig {
API_BASE_URL: string;
OTHER_VAR: string;
}
// Global variable that will be set at runtime
let runtimeConfig: AppConfig = {
API_BASE_URL: import.meta.env.VITE_API_BASE_URL || '',
OTHER_VAR: import.meta.env.VITE_OTHER_VAR || ''
};
// Function to initialize config at runtime
export function initConfig(config: Partial<AppConfig>) {
runtimeConfig = {
...runtimeConfig,
...config
};
}
// Accessor function
export function getConfig(): AppConfig {
return runtimeConfig;
}