about summary refs log tree commit diff
path: root/nix/templates/goapp/frontend/src/init.go
diff options
context:
space:
mode:
authorEmile <git@emile.space>2025-02-22 22:44:31 +0100
committerEmile <git@emile.space>2025-02-22 22:44:31 +0100
commit4100097801550fe86399453b7922875015f34ff9 (patch)
tree5c5103bf72b5b422278900a90c138e73a0bcfb65 /nix/templates/goapp/frontend/src/init.go
parente220cd7ed1ff8b9a84e4660519ca0f74720f9e6e (diff)
goapp frontend now works on corrino
added an overlay (which took quite some time, as I forgot to include
the self parameter in the argument list...) that allows using the
goapp on corrino.

So now you can...
... use the template
... see the package status after it has been built using hydra
... build the package from the packages exposed by the flake
... use the package on machines including it using an overlay

I'm actually quite satisfied with this and hope people find this helpful
Diffstat (limited to 'nix/templates/goapp/frontend/src/init.go')
-rw-r--r--nix/templates/goapp/frontend/src/init.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/nix/templates/goapp/frontend/src/init.go b/nix/templates/goapp/frontend/src/init.go
index 97e58f0..dc0e252 100644
--- a/nix/templates/goapp/frontend/src/init.go
+++ b/nix/templates/goapp/frontend/src/init.go
@@ -32,12 +32,17 @@ func dbInit() {
 
 func sessionInit() {
 	log.Println("[i] Setting up Session Storage...")
+	session_key, err := os.ReadFile(options.SessionKeyPath)
+	if err != nil {
+		log.Println("Could not read Session key")
+		panic(err)
+	}
 	store, err := NewSqliteStore(
 		sessiondbPath,
 		"sessions",
 		"/",
 		3600,
-		[]byte(os.Getenv("SESSION_KEY")))
+		session_key)
 	if err != nil {
 		panic(err)
 	}
@@ -60,14 +65,21 @@ func oauth2Init() (err error) {
 	}
 
 	verifier = provider.Verifier(&oidc.Config{ClientID: options.ClientID})
+
+	clientSecretBytes, err := os.ReadFile(options.ClientSecretPath)
+	if err != nil {
+		panic(err)
+	}
+	clientSecret := string(clientSecretBytes)
+
 	log.Printf("[ ] ClientID: %s", options.ClientID)
-	log.Printf("[ ] ClientSecret: %s", options.ClientSecret)
+	log.Printf("[ ] ClientSecret: %s", clientSecret)
 	log.Printf("[ ] redirectURL: %s", redirectURL.String())
 	log.Printf("[ ] providerEndpoint: %+v", provider.Endpoint())
 	log.Printf("[ ] Scopes: %s", options.Scopes)
 	oauth2Config = oauth2.Config{
 		ClientID:     options.ClientID,
-		ClientSecret: options.ClientSecret,
+		ClientSecret: clientSecret,
 		RedirectURL:  redirectURL.String(),
 		Endpoint:     provider.Endpoint(),
 		Scopes:       strings.Split(options.Scopes, ","),