gitlin/cmd/gothub/env.go
Arya K aa94dcc60a add support for disabling proxying (#94)
fixes #45

Co-authored-by: Arya Kiran <arya@projectsegfau.lt>
Reviewed-on: https://codeberg.org/gothub/gothub/pulls/94
2023-05-16 12:42:17 +00:00

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