From 0d9ff1c20d2fd151be11cc00d4c2dbf600a477bb Mon Sep 17 00:00:00 2001 From: Arthur Danjou Date: Wed, 5 May 2021 19:25:52 +0200 Subject: [PATCH] Fix configs --- config/app.ts | 2 +- config/bodyparser.ts | 13 +++++++++++++ config/database.ts | 18 +----------------- config/mail.ts | 3 ++- config/session.ts | 1 + env.ts | 2 +- tsconfig.json | 1 - 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/config/app.ts b/config/app.ts index 10397a6..6968b02 100644 --- a/config/app.ts +++ b/config/app.ts @@ -126,7 +126,7 @@ export const http: ServerConfig = { | to set the header explicitly. | */ - forceContentNegotiationToJSON: true, + forceContentNegotiationTo: 'application/json', } /* diff --git a/config/bodyparser.ts b/config/bodyparser.ts index 37ff0c8..ea33edf 100644 --- a/config/bodyparser.ts +++ b/config/bodyparser.ts @@ -50,6 +50,7 @@ const bodyParserConfig: BodyParserConfig = { | */ form: { + convertEmptyStringsToNull: true, encoding: 'utf-8', limit: '1mb', queryString: {}, @@ -147,6 +148,18 @@ const bodyParserConfig: BodyParserConfig = { */ encoding: 'utf-8', + /* + |-------------------------------------------------------------------------- + | Convert empty strings to null + |-------------------------------------------------------------------------- + | + | Convert empty form fields to null. HTML forms results in field string + | value when the field is left blank. This option normalizes all the blank + | field values to "null" + | + */ + convertEmptyStringsToNull: true, + /* |-------------------------------------------------------------------------- | Max Fields diff --git a/config/database.ts b/config/database.ts index c240aef..4e5ab15 100644 --- a/config/database.ts +++ b/config/database.ts @@ -6,10 +6,9 @@ */ import Env from '@ioc:Adonis/Core/Env' -import { OrmConfig } from '@ioc:Adonis/Lucid/Orm' import { DatabaseConfig } from '@ioc:Adonis/Lucid/Database' -const databaseConfig: DatabaseConfig & { orm: Partial } = { +const databaseConfig: DatabaseConfig = { /* |-------------------------------------------------------------------------- | Connection @@ -48,21 +47,6 @@ const databaseConfig: DatabaseConfig & { orm: Partial } = { }, }, - - /* - |-------------------------------------------------------------------------- - | ORM Configuration - |-------------------------------------------------------------------------- - | - | Following are some of the configuration options to tweak the conventional - | settings of the ORM. For example: - | - | - Define a custom function to compute the default table name for a given model. - | - Or define a custom function to compute the primary key for a given model. - | - */ - orm: { - }, } export default databaseConfig diff --git a/config/mail.ts b/config/mail.ts index 7391e65..a547551 100644 --- a/config/mail.ts +++ b/config/mail.ts @@ -44,8 +44,9 @@ const mailConfig: MailConfig = { */ mailgun: { driver: 'mailgun', - baseUrl: `https://api.mailgun.net/v3/${Env.get('MAILGUN_URL')}`, + baseUrl: 'https://api.mailgun.net/v3/', key: Env.get('MAILGUN_API_KEY'), + domain: Env.get('MAILGUN_URL'), }, }, diff --git a/config/session.ts b/config/session.ts index 11b7f46..39fd63c 100644 --- a/config/session.ts +++ b/config/session.ts @@ -10,6 +10,7 @@ import { SessionConfig } from '@ioc:Adonis/Addons/Session' const sessionConfig: SessionConfig = { + enabled: true, /* |-------------------------------------------------------------------------- | Driver diff --git a/env.ts b/env.ts index e466f85..994bdb2 100644 --- a/env.ts +++ b/env.ts @@ -52,5 +52,5 @@ export default Env.rules({ //Mails MAILGUN_API_KEY: Env.schema.string(), - MAILGUN_URL: Env.schema.string() + MAILGUN_URL: Env.schema.string(), }) diff --git a/tsconfig.json b/tsconfig.json index 587d39d..f391e67 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,6 @@ }, "types": [ "@adonisjs/core", - "@adonisjs/env", "@adonisjs/repl", "@adonisjs/redis", "@adonisjs/session",