Setting Cookie `key` value in middleware based on `NODE_ENV`

Hey everyone , does anyone know how to set the key value based on NODE_ENV?

when i put process.env.NODE_ENV there, my web app fails (i use my AuthMiddlewareTest as a part of Endpoints Domain definition in for my api and web apps)

// @effect-diagnostics-next-line leakingRequirements:off
export class AuthMiddlewareTest extends HttpApiMiddleware.Tag<AuthMiddleware>()(
  'AuthMiddleware',
  {
    failure: Unauthorized,
    provides: CurrentUserAndSessionIdsTest,
    optional: false,
    security: {
      cookieHeader: HttpApiSecurity.apiKey({
        key: 'some.session_token', // how do make it ENV dependent?
        in: 'cookie',
      }),
      jwtBearer: HttpApiSecurity.bearer,
    },
  },
) {}
Was this page helpful?