Fix Gitea tokens not being found in config.yaml file (#287)

* Adds support for Gitea options in config.yaml file

* Remove debug lines

---------

Co-authored-by: anon <anon@desktop.localdomain>
This commit is contained in:
Antfere
2023-03-11 16:09:08 +00:00
committed by GitHub
parent e470b44967
commit 7f324eac85
2 changed files with 16 additions and 0 deletions

View File

@@ -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()

View File

@@ -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 {