.env files don't appear to work with air
continuous-integration/drone/push Build is passing Details

main
Drew Bednar 2 weeks ago
parent f9a21f475a
commit 663c957880

@ -2,9 +2,6 @@ root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[env]
file = ".env"
[build]
args_bin = ["-log-level=DEBUG"]
bin = "./tmp/main"

@ -1,4 +1,4 @@
export PULLEY_DATABASE_URI=postgres://pulley:passwd@localhost:5434/pulley
export PULLEY_PORT=5002
export PULLEY_LOG_LEVEL="debug"
PULLEY_DATABASE_URI=postgres://pulley:passwd@localhost:5434/pulley
PULLEY_PORT=5002
PULLEY_LOG_LEVEL="debug"

1
.gitignore vendored

@ -25,3 +25,4 @@ go.work
tmp/
.pg_data/
.env
.local.profile

@ -97,9 +97,8 @@ func run(ctx context.Context, w io.Writer, args []string) error {
go func() {
if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
slog.Error(err.Error())
os.Exit(1)
slog.Info("Stopped serving connections")
slog.Error("Error encounterd by webserver in listen loop", "error", err.Error())
cancel()
}
}()
@ -110,9 +109,11 @@ func run(ctx context.Context, w io.Writer, args []string) error {
// signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
// Block until signal is received
//<-sigChan
slog.Info("Listening for shutdown...")
<-appCtx.Done()
slog.Info("Shutdown intitiated")
// We don't want to inherit from appCtx because it has already been canceled at this point
shutdownCtx, shutdownRelease := context.WithTimeout(context.Background(), 10*time.Second)
defer shutdownRelease()

Loading…
Cancel
Save