gitlin/cmd/gothub/env.go

51 行
1.4 KiB
Go
Raw 通常表示 履歴

package gothub
import (
"fmt"
"os"
"github.com/spf13/cobra"
_ "github.com/joho/godotenv/autoload"
)
var envCmd = &cobra.Command{
Use: "env",
Short: "Get environment variable status",
Long: `This command will show you the status of all environment variables that are used by GotHub.`,
Run: func(cmd *cobra.Command, args []string) {
env()
},
}
func init() {
rootCmd.AddCommand(envCmd)
}
func env() {
// Docker check
if os.Getenv("DOCKER") == "true" {
fmt.Println("Docker: true")
} else {
fmt.Println("Docker: false")
}
// Proxying
fmt.Println("Proxying: " + os.Getenv("GOTHUB_PROXYING_ENABLED"))
// IP logging
fmt.Println("IP logging: " + os.Getenv("GOTHUB_IP_LOGGED"))
// URL request logging
fmt.Println("URL request logging: " + os.Getenv("GOTHUB_REQUEST_URL_LOGGED"))
// User-Agent logging
fmt.Println("User-Agent logging: " + os.Getenv("GOTHUB_USER_AGENT_LOGGED"))
// Diagnostic information logging
fmt.Println("Diagnostic information logging: " + os.Getenv("GOTHUB_DIAGNOSTIC_INFO_LOGGED"))
// Privacy Policy URL
fmt.Println("Privacy Policy URL: " + os.Getenv("GOTHUB_INSTANCE_PRIVACY_POLICY"))
// Instance country
fmt.Println("Instance country: " + os.Getenv("GOTHUB_INSTANCE_COUNTRY"))
// ISP
fmt.Println("ISP/Hosting provider: " + os.Getenv("GOTHUB_INSTANCE_PROVIDER"))
// Cloudflare status
fmt.Println("Cloudflare status: " + os.Getenv("GOTHUB_INSTANCE_CLOUDFLARE"))
}