constants

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultBannerText    = "LingEcho"
	BannerAPIURLTemplate = "https://patorjk.com/software/taag/ajax/convert.php?text=%s&font=doom"
	BannerRefererURL     = "https://patorjk.com/software/taag/"
	BannerAPITimeout     = 10 * time.Second
	BannerUserAgent      = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
	BannerAcceptHeader   = "text/plain, */*"
	DoomFontHeight       = 8
	DoomFontSpaceWidth   = 2
	DoomFontUnknownChar  = "? "
	BannerFilePerm       = 0644
)

Banner generation constants

View Source
const (
	HTMLDoctypePrefix = "<!DOCTYPE"
	HTMLTagPrefix     = "<html"
	HTML404Error      = "404 Error"
	HTMLBrTag         = "<br>"
	HTMLBrSelfClose   = "<br/>"
	HTMLBrCloseSpace  = "<br />"
	ASCIIArtChars     = "|_/\\-="
)

HTML detection substrings for banner API response validation

View Source
const (
	SQLFileExtension       = ".sql"
	SQLStatementTerminator = ";"
	SQLCommentPrefix       = "--"
	SQLHashCommentPrefix   = "#"
	SQLScannerBufferSize   = 1024 * 1024
	DefaultMigrationsDir   = "cmd/bootstrap/migrations"
	SQLAlterTablePrefix    = "ALTER TABLE "
	SQLConvertUTF8MB4      = " CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
)

SQL / database initialization constants

View Source
const (
	ErrSubstrDuplicateEntry   = "duplicate entry"
	ErrSubstrUniqueConstraint = "unique constraint"
)

Duplicate key error detection substrings (case-insensitive match)

View Source
const (
	DefaultMinJWKSKeys              = 3
	DefaultJWKSMinimumKeepOldKeys   = 2
	KeyDirPerm                      = 0700
	DefaultKeyRotationCheckInterval = 24 * time.Hour
	HoursPerDay                     = 24
)

JWKS key management defaults

View Source
const (
	ANSIReset = "\x1b[0m"

	// Banner gradient (light blue → dark blue)
	ANSIBannerGradient1 = "\x1b[38;5;117m"
	ANSIBannerGradient2 = "\x1b[38;5;111m"
	ANSIBannerGradient3 = "\x1b[38;5;75m"
	ANSIBannerGradient4 = "\x1b[38;5;39m"
	ANSIBannerGradient5 = "\x1b[38;5;33m"
	ANSIBannerGradient6 = "\x1b[38;5;27m"
)

ANSI terminal control codes

View Source
const (
	DefaultSiteURL         = "https://lingecho.com"
	DefaultSiteName        = "LingEchoX"
	DefaultSiteDescription = "SoulNexus - Intelligent Voice Customer Service Platform"
)

Default site values for seed data

View Source
const (
	TableMailTemplates = "mail_templates"
	TableMailLogs      = "mail_logs"
	TableSMSLogs       = "sms_logs"
)

Table names used in bootstrap (raw SQL in seeds)

View Source
const (
	ENV_LOCAL = "local"
	ENV_DEV   = "dev"
	ENV_PROD  = "prod"

	// Backup env keys
	ENV_BACKUP_ENABLED        = "BACKUP_ENABLED"
	ENV_BACKUP_PATH           = "BACKUP_PATH"
	ENV_BACKUP_SCHEDULE       = "BACKUP_SCHEDULE"
	ENV_BACKUP_RETENTION_DAYS = "BACKUP_RETENTION_DAYS"

	// Database driver names
	DBDriverSQLite = "sqlite"
	DBDriverMySQL  = "mysql"
	DBDriverPG     = "postgres"
)
View Source
const (
	ENV_DB_DRIVER             = "DB_DRIVER"
	ENV_DSN                   = "DSN"
	ENV_DB_MAX_OPEN_CONNS     = "DB_MAX_OPEN_CONNS"
	ENV_DB_MAX_IDLE_CONNS     = "DB_MAX_IDLE_CONNS"
	ENV_DB_CONN_MAX_LIFETIME  = "DB_CONN_MAX_LIFETIME"
	ENV_DB_CONN_MAX_IDLE_TIME = "DB_CONN_MAX_IDLE_TIME"
	ENV_CONFIG_CACHE_SIZE     = "CONFIG_CACHE_SIZE"
	ENV_CONFIG_CACHE_EXPIRED  = "CONFIG_CACHE_EXPIRED"
)

Environment variable keys for database / config cache

View Source
const (
	DefaultServerAddr = ":8082"
	DefaultUploadDir  = "./data/uploads"
)

Server defaults

View Source
const (
	DefaultReadHeaderTimeout  = 30 * time.Second
	DefaultReadTimeout        = 5 * time.Minute
	DefaultIdleTimeout        = 120 * time.Second
	DefaultShutdownTimeout    = 25 * time.Second
	DefaultMaxHeaderBytes     = 1 << 20  // 1 MB
	DefaultMaxMultipartMemory = 32 << 20 // 32 MB
)

Timeout / size defaults

View Source
const (
	DefaultSessionExpireDays   = 7
	DefaultSessionRandomKeyLen = 32
)

Session defaults

View Source
const (
	DefaultSIPHost    = "0.0.0.0"
	DefaultSIPPort    = 6050
	DefaultSIPLocalIP = "127.0.0.1"
)

SIP defaults

View Source
const (
	TimezoneShanghai   = "Asia/Shanghai"       // China Standard Time (UTC+8)
	TimezoneTokyo      = "Asia/Tokyo"          // Japan Standard Time (UTC+9)
	TimezoneSingapore  = "Asia/Singapore"      // Singapore Time (UTC+8)
	TimezoneKolkata    = "Asia/Kolkata"        // India Standard Time (UTC+5:30)
	TimezoneDubai      = "Asia/Dubai"          // Gulf Standard Time (UTC+4)
	TimezoneLondon     = "Europe/London"       // GMT/BST (UTC+0/+1)
	TimezoneParis      = "Europe/Paris"        // Central European Time (UTC+1/+2)
	TimezoneBerlin     = "Europe/Berlin"       // Central European Time (UTC+1/+2)
	TimezoneMoscow     = "Europe/Moscow"       // Moscow Standard Time (UTC+3)
	TimezoneNewYork    = "America/New_York"    // Eastern Time (UTC-5/-4)
	TimezoneChicago    = "America/Chicago"     // Central Time (UTC-6/-5)
	TimezoneLosAngeles = "America/Los_Angeles" // Pacific Time (UTC-8/-7)
	TimezoneSaoPaulo   = "America/Sao_Paulo"   // Brasilia Time (UTC-3)
	TimezoneSydney     = "Australia/Sydney"    // Australian Eastern Time (UTC+10/+11)
	TimezoneAuckland   = "Pacific/Auckland"    // New Zealand Time (UTC+12/+13)
	TimezoneUTC        = "UTC"                 // Coordinated Universal Time
)

Timezone constants (IANA names). Use these with logger.InitTimezone instead of hardcoding string literals throughout the codebase.

View Source
const (
	DefaultLogRetentionInterval       = 24 * time.Hour
	DefaultSignalingRetentionInterval = 6 * time.Hour
	DefaultSIPUserOnlineSweepSeconds  = 30
)

Retention / scheduler intervals

View Source
const (
	ENV_MODE                          = "MODE"
	ENV_SIP_USER_ONLINE_SWEEP_SECONDS = "SIP_USER_ONLINE_SWEEP_SECONDS"
	ENV_PROFILE_AUTO_PPROF            = "PROFILE_AUTO_PPROF"
	ENV_PPROF_ENABLED                 = "PPROF_ENABLED"
	ENV_UPLOAD_DIR                    = "UPLOAD_DIR"
)

Environment variable keys

View Source
const (
	DefaultBannerFile    = "banner.txt"
	SignalChannelBufSize = 1
)

Misc

View Source
const DbField = "_ling_db"
View Source
const DefaultTimezone = TimezoneShanghai

DefaultTimezone is the fallback timezone when the configured name is empty or invalid. Aligned with logger.DefaultTimezone.

View Source
const (
	EnvAppEnv = "APP_ENV"
)

App-level environment variable keys

View Source
const (
	SystemActorSeed = "seed"
)

System seed actor name

View Source
const (
	UploadRoute = "/uploads"
)

Route prefixes

Variables

This section is empty.

Functions

func IsProdMode

func IsProdMode(mode string) bool

IsProdMode reports whether a MODE value requests production-strict behaviour. Single source of truth for the prod check — the long form "production" is matched as a prefix of ENV_PROD instead of a second constant.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL