start: propagate init errors

package users can now act accordingly on startup errors, for example
by exiting with a non-zero code. this is useful when running a service,
notifying a supervising process about such failures.

although this is technically a breaking change, most pkg users should be
unaffected since Start and StartConf returned nothing before this commit.
This commit is contained in:
alex
2022-12-22 23:40:20 +01:00
committed by fiatjaf
parent 570912e752
commit 642710fda8
5 changed files with 29 additions and 14 deletions

View File

@@ -75,5 +75,7 @@ func main() {
return
}
r.storage = &postgresql.PostgresBackend{DatabaseURL: r.PostgresDatabase}
relayer.Start(&r)
if err := relayer.Start(&r); err != nil {
relayer.Log.Fatal().Err(err).Msg("server terminated")
}
}