package gitlin

import (
  "fmt"
  "os"

  "gitler.moe/suwako/gitlin/utils"
  "github.com/spf13/cobra"
)

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 Gitlin.`,
  Run: func(cmd *cobra.Command, args []string) {
    env()
  },
}

func init() {
  utils.LoadCnf()
  rootCmd.AddCommand(envCmd)
}

func env() {
  // Proxying
  fmt.Println("Proxying: " + os.Getenv("GITLIN_PROXYING_ENABLED"))
  // IP logging
  fmt.Println("IP logging: " + os.Getenv("GITLIN_IP_LOGGED"))
  // URL request logging
  fmt.Println("URL request logging: " + os.Getenv("GITLIN_REQUEST_URL_LOGGED"))
  // User-Agent logging
  fmt.Println("User-Agent logging: " + os.Getenv("GITLIN_USER_AGENT_LOGGED"))
  // Diagnostic information logging
  fmt.Println("Diagnostic information logging: " + os.Getenv("GITLIN_DIAGNOSTIC_INFO_LOGGED"))
  // Privacy Policy URL
  fmt.Println("Privacy Policy URL: " + os.Getenv("GITLIN_INSTANCE_PRIVACY_POLICY"))
  // Instance country
  fmt.Println("Instance country: " + os.Getenv("GITLIN_INSTANCE_COUNTRY"))
  // ISP
  fmt.Println("ISP/Hosting provider: " + os.Getenv("GITLIN_INSTANCE_PROVIDER"))
  // Cloudflare status
  fmt.Println("Cloudflare status: " + os.Getenv("GITLIN_INSTANCE_CLOUDFLARE"))
}
