Skip to content

Commit 863dfa5

Browse files
authored
Ensure authentication token is set (#28)
* Ensure authentication token is set * Don't panic
1 parent 70dcae2 commit 863dfa5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import (
1717
)
1818

1919
func main() {
20+
// Assert authentication
21+
authToken, ok := os.LookupEnv("LEDGER_AUTH_TOKEN")
22+
if !ok || authToken == "" {
23+
log.Fatal("Cannot start the server. Authentication token is not set!!")
24+
}
25+
2026
db, err := sql.Open("postgres", os.Getenv("DATABASE_URL"))
2127
if err != nil {
2228
log.Panic("Unable to connect to Database:", err)

0 commit comments

Comments
 (0)