Only try to load .env if it exists (#6714)

This commit is contained in:
6543
2026-06-12 20:43:14 +02:00
committed by GitHub
parent eb2d7fe4c7
commit c776564285
7 changed files with 47 additions and 32 deletions
+2 -6
View File
@@ -16,20 +16,16 @@ package main
import (
"context"
"fmt"
"os"
"github.com/joho/godotenv"
"github.com/rs/zerolog/log"
"go.woodpecker-ci.org/woodpecker/v3/shared/dot_env"
"go.woodpecker-ci.org/woodpecker/v3/shared/utils"
)
func main() {
if err := godotenv.Load(); err != nil {
fmt.Fprintf(os.Stderr, "Error could not load .env: %s", err)
os.Exit(1)
}
dot_env.Load()
ctx := utils.WithContextSigtermCallback(context.Background(), func() {
log.Info().Msg("termination signal is received, terminate cli")