gitlin/cmd/gothub/env.go
Odyssium 148ee1594f better formatting for setup command
Signed-off-by: Odyssium <hi@odyssey346.dev>
2023-04-02 16:22:54 +02:00

49 行
1.3 KiB
Go

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")
}
// 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"))
}