feat(config): enable dynamic API host configuration via env var

This commit is contained in:
Tiago Yamamoto 2025-12-15 10:55:16 -03:00
parent ce31ab8e67
commit 0a69406b31
5 changed files with 13 additions and 1687 deletions

View file

@ -21,6 +21,7 @@ JWT_SECRET=your-secret-key-change-this-in-production-use-strong-random-value
# Server Configuration
PORT=8521
ENV=development
API_HOST=localhost:8521
# CORS Origins (comma-separated)
CORS_ORIGINS=http://localhost:3000,http://localhost:8963

View file

@ -6,6 +6,7 @@ import (
"os"
"github.com/joho/godotenv"
"github.com/rede5/gohorsejobs/backend/docs"
"github.com/rede5/gohorsejobs/backend/internal/database"
"github.com/rede5/gohorsejobs/backend/internal/router"
)
@ -13,7 +14,6 @@ import (
// @title GoHorseJobs API
// @version 1.0
// @description API for GoHorseJobs recruitment platform.
// @host localhost:8521
// @BasePath /
func main() {
// Load .env file
@ -33,6 +33,14 @@ func main() {
database.InitDB()
database.RunMigrations()
// Configure Swagger Host dynamically
apiHost := os.Getenv("API_HOST")
if apiHost == "" {
apiHost = "localhost:8521"
}
docs.SwaggerInfo.Host = apiHost
docs.SwaggerInfo.Schemes = []string{"http", "https"}
handler := router.NewRouter()
port := os.Getenv("PORT")
@ -41,6 +49,8 @@ func main() {
}
log.Println("Starting server on :" + port)
log.Println("API Host configured to:", apiHost)
if err := http.ListenAndServe(":"+port, handler); err != nil {
log.Fatalf("Server failed to start: %v", err)
}

View file

@ -15,501 +15,6 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/admin/cloudflare/cache/purge-all": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges all cached content for the configured zone",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge All Cache",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-hosts": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges content by hostnames",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by Hosts",
"parameters": [
{
"description": "Hosts to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeHostsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-tags": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges content by cache tags (Enterprise only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by Tags",
"parameters": [
{
"description": "Tags to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeTagsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-urls": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges specific URLs from cache",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by URLs",
"parameters": [
{
"description": "URLs to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeURLsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/zones": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns all zones associated with the Cloudflare account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "List Cloudflare Zones",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cloudflare.Zone"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns all email accounts for the cPanel account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "List Email Accounts",
"parameters": [
{
"type": "string",
"description": "Filter by domain",
"name": "domain",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cpanel.EmailAccount"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Creates a new email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Create Email Account",
"parameters": [
{
"description": "Email details",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.CreateEmailRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Deletes an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Delete Email Account",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}/password": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Changes the password for an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Change Email Password",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
},
{
"description": "New password",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.ChangePasswordRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}/quota": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Updates the disk quota for an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Update Email Quota",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
},
{
"description": "New quota in MB",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.UpdateQuotaRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/auth/login": {
"post": {
"description": "Authenticates a user by email and password. Returns JWT and user info.",
@ -1350,150 +855,6 @@ const docTemplate = `{
}
},
"definitions": {
"cloudflare.Error": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"message": {
"type": "string"
}
}
},
"cloudflare.PurgeHostsRequest": {
"type": "object",
"properties": {
"hosts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.PurgeResponse": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"$ref": "#/definitions/cloudflare.Error"
}
},
"messages": {
"type": "array",
"items": {
"type": "string"
}
},
"result": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"success": {
"type": "boolean"
}
}
},
"cloudflare.PurgeTagsRequest": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.PurgeURLsRequest": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.Zone": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"cpanel.ChangePasswordRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
}
}
},
"cpanel.CreateEmailRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"quota": {
"description": "MB, 0 = unlimited",
"type": "integer"
}
}
},
"cpanel.EmailAccount": {
"type": "object",
"properties": {
"diskquota": {
"type": "string"
},
"diskused": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"humandiskquota": {
"type": "string"
},
"humandiskused": {
"type": "string"
},
"login": {
"type": "string"
}
}
},
"cpanel.UpdateQuotaRequest": {
"type": "object",
"properties": {
"quota": {
"description": "MB",
"type": "integer"
}
}
},
"dto.AuthResponse": {
"type": "object",
"properties": {
@ -2074,7 +1435,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8521",
Host: "",
BasePath: "/",
Schemes: []string{},
Title: "GoHorseJobs API",

View file

@ -6,504 +6,8 @@
"contact": {},
"version": "1.0"
},
"host": "localhost:8521",
"basePath": "/",
"paths": {
"/api/v1/admin/cloudflare/cache/purge-all": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges all cached content for the configured zone",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge All Cache",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-hosts": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges content by hostnames",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by Hosts",
"parameters": [
{
"description": "Hosts to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeHostsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-tags": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges content by cache tags (Enterprise only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by Tags",
"parameters": [
{
"description": "Tags to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeTagsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/cache/purge-urls": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Purges specific URLs from cache",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "Purge Cache by URLs",
"parameters": [
{
"description": "URLs to purge",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cloudflare.PurgeURLsRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cloudflare.PurgeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cloudflare/zones": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns all zones associated with the Cloudflare account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - Cloudflare"
],
"summary": "List Cloudflare Zones",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cloudflare.Zone"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns all email accounts for the cPanel account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "List Email Accounts",
"parameters": [
{
"type": "string",
"description": "Filter by domain",
"name": "domain",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cpanel.EmailAccount"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Creates a new email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Create Email Account",
"parameters": [
{
"description": "Email details",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.CreateEmailRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Deletes an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Delete Email Account",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}/password": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Changes the password for an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Change Email Password",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
},
{
"description": "New password",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.ChangePasswordRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/admin/cpanel/emails/{email}/quota": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Updates the disk quota for an email account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin - cPanel"
],
"summary": "Update Email Quota",
"parameters": [
{
"type": "string",
"description": "Email address",
"name": "email",
"in": "path",
"required": true
},
{
"description": "New quota in MB",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cpanel.UpdateQuotaRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/auth/login": {
"post": {
"description": "Authenticates a user by email and password. Returns JWT and user info.",
@ -1344,150 +848,6 @@
}
},
"definitions": {
"cloudflare.Error": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"message": {
"type": "string"
}
}
},
"cloudflare.PurgeHostsRequest": {
"type": "object",
"properties": {
"hosts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.PurgeResponse": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"$ref": "#/definitions/cloudflare.Error"
}
},
"messages": {
"type": "array",
"items": {
"type": "string"
}
},
"result": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"success": {
"type": "boolean"
}
}
},
"cloudflare.PurgeTagsRequest": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.PurgeURLsRequest": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cloudflare.Zone": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"cpanel.ChangePasswordRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
}
}
},
"cpanel.CreateEmailRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"quota": {
"description": "MB, 0 = unlimited",
"type": "integer"
}
}
},
"cpanel.EmailAccount": {
"type": "object",
"properties": {
"diskquota": {
"type": "string"
},
"diskused": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"humandiskquota": {
"type": "string"
},
"humandiskused": {
"type": "string"
},
"login": {
"type": "string"
}
}
},
"cpanel.UpdateQuotaRequest": {
"type": "object",
"properties": {
"quota": {
"description": "MB",
"type": "integer"
}
}
},
"dto.AuthResponse": {
"type": "object",
"properties": {

View file

@ -1,98 +1,5 @@
basePath: /
definitions:
cloudflare.Error:
properties:
code:
type: integer
message:
type: string
type: object
cloudflare.PurgeHostsRequest:
properties:
hosts:
items:
type: string
type: array
type: object
cloudflare.PurgeResponse:
properties:
errors:
items:
$ref: '#/definitions/cloudflare.Error'
type: array
messages:
items:
type: string
type: array
result:
properties:
id:
type: string
type: object
success:
type: boolean
type: object
cloudflare.PurgeTagsRequest:
properties:
tags:
items:
type: string
type: array
type: object
cloudflare.PurgeURLsRequest:
properties:
urls:
items:
type: string
type: array
type: object
cloudflare.Zone:
properties:
id:
type: string
name:
type: string
status:
type: string
type: object
cpanel.ChangePasswordRequest:
properties:
password:
type: string
type: object
cpanel.CreateEmailRequest:
properties:
email:
type: string
password:
type: string
quota:
description: MB, 0 = unlimited
type: integer
type: object
cpanel.EmailAccount:
properties:
diskquota:
type: string
diskused:
type: string
domain:
type: string
email:
type: string
humandiskquota:
type: string
humandiskused:
type: string
login:
type: string
type: object
cpanel.UpdateQuotaRequest:
properties:
quota:
description: MB
type: integer
type: object
dto.AuthResponse:
properties:
token:
@ -487,325 +394,12 @@ definitions:
workingHours:
type: string
type: object
host: localhost:8521
info:
contact: {}
description: API for GoHorseJobs recruitment platform.
title: GoHorseJobs API
version: "1.0"
paths:
/api/v1/admin/cloudflare/cache/purge-all:
post:
consumes:
- application/json
description: Purges all cached content for the configured zone
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/cloudflare.PurgeResponse'
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Purge All Cache
tags:
- Admin - Cloudflare
/api/v1/admin/cloudflare/cache/purge-hosts:
post:
consumes:
- application/json
description: Purges content by hostnames
parameters:
- description: Hosts to purge
in: body
name: body
required: true
schema:
$ref: '#/definitions/cloudflare.PurgeHostsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/cloudflare.PurgeResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Purge Cache by Hosts
tags:
- Admin - Cloudflare
/api/v1/admin/cloudflare/cache/purge-tags:
post:
consumes:
- application/json
description: Purges content by cache tags (Enterprise only)
parameters:
- description: Tags to purge
in: body
name: body
required: true
schema:
$ref: '#/definitions/cloudflare.PurgeTagsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/cloudflare.PurgeResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Purge Cache by Tags
tags:
- Admin - Cloudflare
/api/v1/admin/cloudflare/cache/purge-urls:
post:
consumes:
- application/json
description: Purges specific URLs from cache
parameters:
- description: URLs to purge
in: body
name: body
required: true
schema:
$ref: '#/definitions/cloudflare.PurgeURLsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/cloudflare.PurgeResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Purge Cache by URLs
tags:
- Admin - Cloudflare
/api/v1/admin/cloudflare/zones:
get:
consumes:
- application/json
description: Returns all zones associated with the Cloudflare account
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/cloudflare.Zone'
type: array
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: List Cloudflare Zones
tags:
- Admin - Cloudflare
/api/v1/admin/cpanel/emails:
get:
consumes:
- application/json
description: Returns all email accounts for the cPanel account
parameters:
- description: Filter by domain
in: query
name: domain
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/cpanel.EmailAccount'
type: array
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: List Email Accounts
tags:
- Admin - cPanel
post:
consumes:
- application/json
description: Creates a new email account
parameters:
- description: Email details
in: body
name: body
required: true
schema:
$ref: '#/definitions/cpanel.CreateEmailRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Create Email Account
tags:
- Admin - cPanel
/api/v1/admin/cpanel/emails/{email}:
delete:
consumes:
- application/json
description: Deletes an email account
parameters:
- description: Email address
in: path
name: email
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Delete Email Account
tags:
- Admin - cPanel
/api/v1/admin/cpanel/emails/{email}/password:
put:
consumes:
- application/json
description: Changes the password for an email account
parameters:
- description: Email address
in: path
name: email
required: true
type: string
- description: New password
in: body
name: body
required: true
schema:
$ref: '#/definitions/cpanel.ChangePasswordRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Change Email Password
tags:
- Admin - cPanel
/api/v1/admin/cpanel/emails/{email}/quota:
put:
consumes:
- application/json
description: Updates the disk quota for an email account
parameters:
- description: Email address
in: path
name: email
required: true
type: string
- description: New quota in MB
in: body
name: body
required: true
schema:
$ref: '#/definitions/cpanel.UpdateQuotaRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Update Email Quota
tags:
- Admin - cPanel
/api/v1/auth/login:
post:
consumes: