more implementation of runtime unlock
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-12-28 11:14:16 +11:00
parent 9203e09d2d
commit 484acd1822
7 changed files with 115 additions and 43 deletions

13
main.go
View File

@@ -49,14 +49,17 @@ func main() {
log.SetOutput(logfileWriter)
log.Printf("SMT starting execution. Built on %s from sha1 %s\n", buildTime, sha1ver)
// Set secrets key from .env file
keyString = os.Getenv("SECRETS_KEY")
// Initiate connection to sqlite and make sure our schema is up to date
models.ConnectDatabase()
// let the models package know our secrets key
models.LoadSecretKey(keyString)
// Set secrets key from .env file
keyString = os.Getenv("SECRETS_KEY")
if keyString != "" {
// Key was defined in environment variable, let the models package know our secrets key
log.Println("Found secret key in environment variable")
models.ReceiveKey(keyString)
}
// Create context that listens for the interrupt signal from the OS.
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)