Files
be-service-qris/test_swagger_env.go
2025-08-24 16:18:15 +07:00

35 lines
1.4 KiB
Go

package main
import (
"fmt"
"os"
)
func main() {
// Set environment variables for testing
os.Setenv("SWAGGER_TITLE", "My Custom API Service")
os.Setenv("SWAGGER_DESCRIPTION", "This is a custom API service for managing various resources")
os.Setenv("SWAGGER_VERSION", "2.0.0")
os.Setenv("SWAGGER_CONTACT_NAME", "Support Team")
os.Setenv("SWAGGER_CONTACT_URL", "https://mycompany.com/support")
os.Setenv("SWAGGER_CONTACT_EMAIL", "support@mycompany.com")
os.Setenv("SWAGGER_LICENSE_NAME", "MIT License")
os.Setenv("SWAGGER_LICENSE_URL", "https://opensource.org/licenses/MIT")
os.Setenv("SWAGGER_HOST", "api.mycompany.com:8080")
os.Setenv("SWAGGER_BASE_PATH", "/api/v2")
os.Setenv("SWAGGER_SCHEMES", "https")
fmt.Println("Environment variables set for Swagger documentation:")
fmt.Println("SWAGGER_TITLE:", os.Getenv("SWAGGER_TITLE"))
fmt.Println("SWAGGER_DESCRIPTION:", os.Getenv("SWAGGER_DESCRIPTION"))
fmt.Println("SWAGGER_VERSION:", os.Getenv("SWAGGER_VERSION"))
fmt.Println("SWAGGER_CONTACT_NAME:", os.Getenv("SWAGGER_CONTACT_NAME"))
fmt.Println("SWAGGER_HOST:", os.Getenv("SWAGGER_HOST"))
fmt.Println("SWAGGER_BASE_PATH:", os.Getenv("SWAGGER_BASE_PATH"))
fmt.Println("SWAGGER_SCHEMES:", os.Getenv("SWAGGER_SCHEMES"))
fmt.Println("\nTo test the Swagger generation, run:")
fmt.Println("swag init -g cmd/api/main.go --parseDependency --parseInternal")
fmt.Println("Then check docs/docs.go to see the updated values")
}