Switch to auth_secret file that's compiled in at runtime instead of a hardcoded string
This commit is contained in:
parent
35e7a5641f
commit
e908495c0c
|
@ -1,2 +1,3 @@
|
|||
shroom_server
|
||||
shrooms.db
|
||||
auth_secret
|
||||
|
|
|
@ -21,6 +21,9 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
//go:embed auth_secret
|
||||
var auth_secret string
|
||||
|
||||
//go:embed static/*
|
||||
var content embed.FS
|
||||
|
||||
|
@ -138,10 +141,10 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
// TODO switch to embedded secret
|
||||
if adminReq.Auth != "password" {
|
||||
// switch to embedded secret
|
||||
if adminReq.Auth != auth_secret {
|
||||
w.WriteHeader(401)
|
||||
w.Write([]byte(err.Error()))
|
||||
w.Write([]byte("invalid secret"))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue