@@ -153,15 +153,6 @@ func NewContainer(projectID string, version string) (container *Container) {
153153 return container
154154}
155155
156- func GetEnvWithDefault (key , defaultValue string ) string {
157- value := os .Getenv (key )
158- if value == "" {
159- return defaultValue
160- }
161-
162- return value
163- }
164-
165156// App creates a new instance of fiber.App
166157func (container * Container ) App () (app * fiber.App ) {
167158 if container .app != nil {
@@ -179,15 +170,14 @@ func (container *Container) App() (app *fiber.App) {
179170 app .Use (otelfiber .Middleware ())
180171 app .Use (cors .New (
181172 cors.Config {
182- AllowOrigins : GetEnvWithDefault ("CORS_ALLOW_ORIGINS" , "*" ),
183- AllowHeaders : GetEnvWithDefault ("CORS_ALLOW_HEADERS" , "*" ),
184- AllowMethods : GetEnvWithDefault ("CORS_ALLOW_METHODS" , "GET,POST,PUT,DELETE,OPTIONS" ),
173+ AllowOrigins : getEnvWithDefault ("CORS_ALLOW_ORIGINS" , "*" ),
174+ AllowHeaders : getEnvWithDefault ("CORS_ALLOW_HEADERS" , "*" ),
175+ AllowMethods : getEnvWithDefault ("CORS_ALLOW_METHODS" , "GET,POST,PUT,DELETE,OPTIONS" ),
185176 AllowCredentials : false ,
186- ExposeHeaders : GetEnvWithDefault ("CORS_EXPOSE_HEADERS" , "*" ),
187- }))
188-
177+ ExposeHeaders : getEnvWithDefault ("CORS_EXPOSE_HEADERS" , "*" ),
178+ }),
179+ )
189180 app .Use (middlewares .HTTPRequestLogger (container .Tracer (), container .Logger ()))
190-
191181 app .Use (middlewares .BearerAuth (container .Logger (), container .Tracer (), container .FirebaseAuthClient ()))
192182 app .Use (middlewares .APIKeyAuth (container .Logger (), container .Tracer (), container .UserRepository ()))
193183
@@ -1396,10 +1386,10 @@ func (container *Container) UserRepository() repositories.UserRepository {
13961386 )
13971387}
13981388
1399- // UserRistrettoCache creates an in-memory *ristretto.Cache[string, entities.AuthUser ]
1400- func (container * Container ) UserRistrettoCache () (cache * ristretto.Cache [string , entities.AuthUser ]) {
1389+ // UserRistrettoCache creates an in-memory *ristretto.Cache[string, entities.AuthContext ]
1390+ func (container * Container ) UserRistrettoCache () (cache * ristretto.Cache [string , entities.AuthContext ]) {
14011391 container .logger .Debug (fmt .Sprintf ("creating %T" , cache ))
1402- ristrettoCache , err := ristretto.NewCache [string , entities.AuthUser ](& ristretto.Config [string , entities.AuthUser ]{
1392+ ristrettoCache , err := ristretto.NewCache [string , entities.AuthContext ](& ristretto.Config [string , entities.AuthContext ]{
14031393 MaxCost : 5000 ,
14041394 NumCounters : 5000 * 10 ,
14051395 BufferItems : 64 ,
0 commit comments