wikipedia-game-solver/apps/api/config/app.ts

40 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2024-08-15 15:14:21 +02:00
import env from "#start/env.ts"
2024-08-09 23:51:41 +02:00
import { Secret } from "@adonisjs/core/helpers"
import { defineConfig } from "@adonisjs/core/http"
import app from "@adonisjs/core/services/app"
/**
* The app key is used for encrypting cookies, generating signed URLs, and by the "encryption" module.
*
* The encryption module will fail to decrypt data if the key is lost or changed.
* Therefore it is recommended to keep the app key secure.
*/
2024-08-12 19:19:43 +02:00
export const APP_KEY_HEADER_NAME = "x-app-key"
export const APP_KEY = env.get("APP_KEY")
export const appKey = new Secret(APP_KEY)
2024-08-09 23:51:41 +02:00
/**
* The configuration settings used by the HTTP server
*/
export const http = defineConfig({
generateRequestId: true,
allowMethodSpoofing: false,
/**
* Enabling async local storage will let you access HTTP context from anywhere inside your application.
*/
useAsyncLocalStorage: false,
/**
* Manage cookies configuration. The settings for the session id cookie are defined inside the "config/session.ts" file.
*/
cookie: {
domain: "",
path: "/",
maxAge: "2h",
httpOnly: true,
secure: app.inProduction,
sameSite: "lax",
},
})