| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #ifndef SERVER_CONFIG_H
- #define SERVER_CONFIG_H
- #include <string>
- #include <vector>
- /**
- * @brief Authentication method enumeration
- */
- enum class AuthMethod {
- NONE, ///< No authentication required
- JWT, ///< JWT token authentication
- API_KEY, ///< API key authentication
- UNIX, ///< Unix system authentication
- PAM, ///< PAM authentication
- OPTIONAL ///< Authentication optional (guest access allowed)
- };
- /**
- * @brief Authentication configuration structure
- */
- struct AuthConfig {
- AuthMethod authMethod = AuthMethod::NONE; ///< Primary authentication method
- bool enableGuestAccess = false; ///< Allow unauthenticated access
- std::string jwtSecret = ""; ///< JWT secret key (auto-generated if empty)
- int jwtExpirationMinutes = 60; ///< JWT token expiration in minutes
- std::string authRealm = "stable-diffusion-rest"; ///< Authentication realm
- std::string dataDir = "./auth"; ///< Directory for authentication data
- std::string pamServiceName = "stable-diffusion-rest"; ///< PAM service name
- std::vector<std::string> publicPaths; ///< Paths that don't require authentication
- std::vector<std::string> adminPaths; ///< Paths that require admin access
- std::vector<std::string> userPaths; ///< Paths that require user access
- std::string customPublicPaths; ///< Custom public paths (comma-separated)
- };
- // Server configuration structure
- struct ServerConfig {
- // Server settings
- std::string host = "0.0.0.0";
- int port = 8080;
- int maxConcurrentGenerations = 1;
- bool verbose = false;
- // Required directory parameter
- std::string modelsDir = ""; // Base models directory (required, must be set via --models-dir)
- // Model type directory parameters
- // All default to standard folder names under modelsDir if not explicitly set
- std::string checkpoints = ""; // Checkpoints directory (default: checkpoints)
- std::string controlnetDir = ""; // ControlNet directory (default: controlnet)
- std::string embeddingsDir = ""; // Embeddings directory (default: embeddings)
- std::string esrganDir = ""; // ESRGAN directory (default: ESRGAN)
- std::string loraDir = ""; // LoRA directory (default: loras)
- std::string taesdDir = ""; // TAESD directory (default: TAESD)
- std::string vaeDir = ""; // VAE directory (default: vae)
- std::string diffusionModelsDir = ""; // Diffusion models directory (default: diffusion_models)
- // Queue and output directories
- std::string queueDir = "./queue"; // Directory to store queue job files
- std::string outputDir = "./output"; // Directory to store generated images/videos
- // UI directory (optional - for serving static web UI)
- std::string uiDir = ""; // Directory containing static web UI files
- // Logging options
- bool enableFileLogging = false;
- std::string logFilePath = "/var/log/stable-diffusion-rest/server.log";
- // Authentication configuration
- AuthConfig auth;
- };
- #endif // SERVER_CONFIG_H
|