From f2c175ca1df2563f6a3aae750d7d93d9bcf5a0f7 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Thu, 31 Oct 2024 11:28:43 +0100
Subject: [PATCH] fix: context constants must be public

---
 constants.go           |  2 +-
 flake.lock             | 12 ++++++------
 go.mod                 |  6 +++---
 go.sum                 | 12 ++++++------
 http-handler.go        |  4 ++--
 http-handler_test.go   |  2 +-
 nix/config/release.nix |  6 +++---
 7 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/constants.go b/constants.go
index 9799c0e..e0dbdd3 100644
--- a/constants.go
+++ b/constants.go
@@ -6,7 +6,7 @@ package configuration
 type ContextKey string
 
 const fileName = "config"
-const contextKey = ContextKey("config")
+const ContextConfigKey = ContextKey("config")
 
 const envTagKey = "env"
 const flagTagKey = "flag"
diff --git a/flake.lock b/flake.lock
index fd83cb2..a0e8464 100644
--- a/flake.lock
+++ b/flake.lock
@@ -72,11 +72,11 @@
     },
     "nixpkgsUnstable": {
       "locked": {
-        "lastModified": 1727348695,
-        "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
+        "lastModified": 1730200266,
+        "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
+        "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd",
         "type": "github"
       },
       "original": {
@@ -88,11 +88,11 @@
     },
     "nixpkgs_2": {
       "locked": {
-        "lastModified": 1727397532,
-        "narHash": "sha256-pojbL/qteElw/nIXlN8kmHn/w6PQbEHr7Iz+WOXs0EM=",
+        "lastModified": 1730137625,
+        "narHash": "sha256-9z8oOgFZiaguj+bbi3k4QhAD6JabWrnv7fscC/mt0KE=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "f65141456289e81ea0d5a05af8898333cab5c53d",
+        "rev": "64b80bfb316b57cdb8919a9110ef63393d74382a",
         "type": "github"
       },
       "original": {
diff --git a/go.mod b/go.mod
index 769044e..3c9d4a2 100644
--- a/go.mod
+++ b/go.mod
@@ -15,16 +15,16 @@ require (
 	gitlab.schukai.com/oss/libraries/go/network/http-negotiation.git v1.3.4
 	gitlab.schukai.com/oss/libraries/go/utilities/pathfinder.git v0.9.5
 	gitlab.schukai.com/oss/libraries/go/utilities/watch.git v0.4.2
-	golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
+	golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
 	gopkg.in/yaml.v3 v3.0.1
 )
 
 require (
 	github.com/davecgh/go-spew v1.1.1 // indirect
-	github.com/fsnotify/fsnotify v1.7.0 // indirect
+	github.com/fsnotify/fsnotify v1.8.0 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
-	golang.org/x/sys v0.25.0 // indirect
+	golang.org/x/sys v0.26.0 // indirect
 )
 
 replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
diff --git a/go.sum b/go.sum
index 6a220c1..473b897 100644
--- a/go.sum
+++ b/go.sum
@@ -1,8 +1,8 @@
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
-github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
+github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
+github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
 github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
 github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
@@ -32,10 +32,10 @@ gitlab.schukai.com/oss/libraries/go/utilities/pathfinder.git v0.9.5 h1:PiDmw3O3U
 gitlab.schukai.com/oss/libraries/go/utilities/pathfinder.git v0.9.5/go.mod h1:HwXjaFUAxLv+qTN63xrPBO5DEVGuZNF859t29bhTsFQ=
 gitlab.schukai.com/oss/libraries/go/utilities/watch.git v0.4.2 h1:PoX7Cxmclttb5lIrrHZ5QvIjN5MAaaWvReFU972RgpM=
 gitlab.schukai.com/oss/libraries/go/utilities/watch.git v0.4.2/go.mod h1:7Rv8r5eVw5FDRp/K3KlDmjNMrdj7JA7eC3o6s7JBcHU=
-golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
-golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
-golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
-golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
+golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
+golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
+golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/http-handler.go b/http-handler.go
index 75dba80..abc3c3e 100644
--- a/http-handler.go
+++ b/http-handler.go
@@ -10,12 +10,12 @@ import (
 	"net/http"
 )
 
-// ContextKey is the key used to store the configuration in the request context
+// ContextConfigKey is the key used to store the configuration in the request context
 // This is used by the middleware
 func (s *Settings[C]) Middleware(next http.Handler) http.Handler {
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		ctx := r.Context()
-		ctx = context.WithValue(ctx, contextKey, s.config)
+		ctx = context.WithValue(ctx, ContextConfigKey, s.config)
 		r = r.WithContext(ctx)
 		next.ServeHTTP(w, r)
 	})
diff --git a/http-handler_test.go b/http-handler_test.go
index 070f3a5..3a92e37 100644
--- a/http-handler_test.go
+++ b/http-handler_test.go
@@ -53,7 +53,7 @@ func TestConfigurationMiddleware(t *testing.T) {
 	}
 
 	nextHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		val := r.Context().Value(ContextKey("config"))
+		val := r.Context().Value(ContextConfigKey)
 		if val == nil {
 			t.Error("config not present")
 			return
diff --git a/nix/config/release.nix b/nix/config/release.nix
index bf21d9b..f239d51 100644
--- a/nix/config/release.nix
+++ b/nix/config/release.nix
@@ -2,8 +2,8 @@
   # this file is generated by nix/scripts/init-project.nix
   # please don't edit it manually
 
-  version = "v1.22.8";
-  commit = "3cdb9489349e5b6931e0974664ed6a5fbf186c72";
+  version = "1.22.8";
+  commit = "e9bed6ad8a7dfb23781debb49d06317660ec09f4";
   projectURL = "https://gitlab.schukai.com/oss/configuration";
   name = "configuration";
   mnemonic = "configuration";
@@ -12,4 +12,4 @@
 
   # this file is generated by nix/scripts/init-project.nix
   # please don't edit it manually
-}
\ No newline at end of file
+}
-- 
GitLab