Configuration
Das ProcessCube® App-SDK bietet verschiedene Konfigurationsmöglichkeiten für Next.js Anwendungen.
Konfigurationsbereiche
- Environment Variables - Konfiguration von Engine, Authority und anderen Services über Umgebungsvariablen
- Plugin System - withApplicationSdk Plugin für External Tasks und erweiterte Features
Schnellstart
Basis-Konfiguration
Für die meisten Anwendungen genügt diese minimale Konfiguration:
1. Environment Variables
.env.local
PROCESSCUBE_ENGINE_URL=http://localhost:10560
PROCESSCUBE_AUTHORITY_URL=http://localhost:112352. Next.js Config
next.config.ts
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
serverExternalPackages: ['esbuild'],
};
export default nextConfig;Mit External Tasks
Wenn Sie External Tasks verwenden möchten:
next.config.ts
const { withApplicationSdk } = require('@5minds/processcube_app_sdk/server');
const nextConfig = {
serverExternalPackages: ['esbuild'],
applicationSdk: {
useExternalTasks: true,
},
};
module.exports = withApplicationSdk(nextConfig);Konfigurationsoptionen im Überblick
Environment Variables
| Variable | Standard | Beschreibung |
|---|---|---|
PROCESSCUBE_ENGINE_URL | http://localhost:10560 | Engine-Adresse |
PROCESSCUBE_AUTHORITY_URL | - | Authority-Adresse |
NEXTAUTH_CLIENT_ID | - | Client ID für NextAuth.js |
NEXTAUTH_SECRET | - | Secret für NextAuth.js |
Plugin Optionen
| Option | Typ | Standard | Beschreibung |
|---|---|---|---|
useExternalTasks | boolean | false | External Tasks aktivieren |
customExternalTasksDirPath | string | app/external-tasks | Verzeichnis für External Task Handler |
Best Practices
Development vs. Production
Verwenden Sie unterschiedliche Environment Variables für verschiedene Umgebungen:
.env.local (Development)
PROCESSCUBE_ENGINE_URL=http://localhost:10560
PROCESSCUBE_AUTHORITY_URL=http://localhost:11235.env.production (Production)
PROCESSCUBE_ENGINE_URL=https://engine.yourcompany.com
PROCESSCUBE_AUTHORITY_URL=https://authority.yourcompany.comSecrets Management
Speichern Sie Secrets NIEMALS im Git Repository:
.gitignore
.env*.local
.env.productionVerwenden Sie stattdessen:
- Lokal:
.env.local - Production: Environment Variables in Ihrem Hosting-Service (Vercel, AWS, etc.)
Type Safety
Nutzen Sie TypeScript für type-safe Configuration:
lib/config.ts
export const config = {
engineUrl: process.env.PROCESSCUBE_ENGINE_URL || 'http://localhost:10560',
authorityUrl: process.env.PROCESSCUBE_AUTHORITY_URL,
} as const;
// Verwendung
import { config } from '@/lib/config';
console.log(config.engineUrl); // Type-safeTroubleshooting
Environment Variables werden nicht geladen
Problem: Variablen aus .env.local sind undefined
Lösungen:
- Stellen Sie sicher, dass die Datei
.env.localheißt (nicht.env) - Starten Sie den Development Server neu:
npm run dev - Verwenden Sie
NEXT_PUBLIC_Prefix für Client-Side Variables
Plugin funktioniert nicht
Problem: External Tasks starten nicht
Lösungen:
- Überprüfen Sie
withApplicationSdkinnext.config.ts - Setzen Sie
useExternalTasks: true - Prüfen Sie die Console auf Fehler beim Server-Start
Nächste Schritte
- Environment Variables - Alle verfügbaren Variablen
- Plugin System - withApplicationSdk im Detail
- Examples - Vollständige Konfigurationsbeispiele