API URL was not taken from environment after docker container and npm was build
CORS prevented from loading
This commit is contained in:
@@ -26,6 +26,9 @@ type Config struct {
|
||||
|
||||
DevTesting string // "yes" or "no", used to determine if we are in a test environment
|
||||
|
||||
// Frontend URLs for CORS
|
||||
FrontendURL string // Frontend URL for CORS configuration
|
||||
|
||||
// PDF Templates
|
||||
TemplatesDir string // Directory where PDF templates are stored
|
||||
ExportTempDir string // Directory for temporary PDF exports
|
||||
@@ -50,6 +53,7 @@ func defaultConfig() *Config {
|
||||
LogLevel: "INFO",
|
||||
Environment: "production",
|
||||
DevTesting: "no", // Default to "no", can be overridden in tests
|
||||
FrontendURL: "http://localhost:5173", // Default frontend URL for development
|
||||
TemplatesDir: "./templates", // Default templates directory
|
||||
ExportTempDir: "./xporttemp", // Default export temp directory
|
||||
}
|
||||
@@ -117,6 +121,10 @@ func LoadConfig() *Config {
|
||||
fmt.Printf("DEBUG LoadConfig - DEVTESTING nicht gefunden, setze DevTesting auf 'no'\n")
|
||||
}
|
||||
|
||||
// Frontend URL
|
||||
if frontendURL := os.Getenv("BASE_URL"); frontendURL != "" {
|
||||
config.FrontendURL = frontendURL
|
||||
|
||||
// Templates Directory
|
||||
if templatesDir := os.Getenv("TEMPLATES_DIR"); templatesDir != "" {
|
||||
config.TemplatesDir = templatesDir
|
||||
|
||||
Reference in New Issue
Block a user