53 lines
901 B
Go
53 lines
901 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"src.opensuse.org/autogits/common"
|
|
)
|
|
|
|
const (
|
|
GitAuthor = "GiteaBot - Obs Staging"
|
|
)
|
|
|
|
var GiteaToken string
|
|
|
|
func parseObsSecretToken() (string, error) {
|
|
ObsToken := os.Getenv(ObsTokenEnv)
|
|
if len(ObsToken) < 10 {
|
|
return "", fmt.Errorf("Missing %s", ObsTokenEnv)
|
|
}
|
|
|
|
err := os.Setenv(ObsTokenEnv, "")
|
|
if err != nil {
|
|
return "", fmt.Errorf("Cannot reset %s: %v", GiteaTokenEnv, err)
|
|
}
|
|
|
|
return ObsToken, nil
|
|
}
|
|
|
|
func parseGiteaSecretToken() (string, error) {
|
|
GiteaToken := os.Getenv(GiteaTokenEnv)
|
|
if len(GiteaToken) < 10 {
|
|
return errors.New(GiteaTokenEnv + " not provided")
|
|
}
|
|
|
|
err := os.Setenv(GiteaTokenEnv, "")
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %v", "Cannot reset "+GiteaTokenEnv, err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
parseGiteaSecretToken()
|
|
parseObsSecretToken()
|
|
// createListenServer()
|
|
}
|