Config Management
จัดการ configuration ใน Go applications
Environment Variables
Section titled “Environment Variables”package main
import ( "fmt" "os")
func main() { // Get environment variable port := os.Getenv("PORT") if port == "" { port = "8080" // default }
// Check if set apiKey, exists := os.LookupEnv("API_KEY") if !exists { panic("API_KEY is required") }
fmt.Println("Port:", port) fmt.Println("API Key:", apiKey)}เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google