diff --git a/cmd/root.go b/cmd/root.go index b5e228e..f897c75 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -238,6 +238,8 @@ func InitConfig() { getOrSetDefaults("GHORG_RECLONE_PATH") getOrSetDefaults("GHORG_QUIET") getOrSetDefaults("GHORG_GIT_FILTER") + getOrSetDefaults("GHORG_GITEA_TOKEN") + getOrSetDefaults("GHORG_INSECURE_GITEA_CLIENT") if os.Getenv("GHORG_DEBUG") != "" { viper.Debug() diff --git a/configs/configs.go b/configs/configs.go index 4c2957a..4644c4d 100644 --- a/configs/configs.go +++ b/configs/configs.go @@ -168,6 +168,8 @@ func GetOrSetToken() { getOrSetGitLabToken() case "bitbucket": getOrSetBitBucketToken() + default: + getOrSetGiteaToken() } } @@ -227,6 +229,18 @@ func getOrSetBitBucketToken() { } } +func getOrSetGiteaToken() { + var token string + token = os.Getenv("GHORG_GITEA_TOKEN") + + if isZero(token) || len(token) != 40 { + if runtime.GOOS == "windows" { + return + } + os.Setenv("GHORG_GITEA_TOKEN", token) + } +} + // VerifyTokenSet checks to make sure env is set for the correct scm provider func VerifyTokenSet() error {