Finished the States

This commit is contained in:
2021-04-06 09:59:38 +02:00
parent b64158732c
commit 0727e912af
20 changed files with 949 additions and 860 deletions

View File

@@ -126,7 +126,7 @@ export const http: ServerConfig = {
| to set the header explicitly.
|
*/
forceContentNegotiationTo: 'true',
forceContentNegotiationToJSON: true,
}
/*

View File

@@ -98,17 +98,23 @@ const authConfig: AuthConfig = {
/*
|--------------------------------------------------------------------------
| Tokens provider
| Redis provider for managing tokens
|--------------------------------------------------------------------------
|
| Uses SQL database config for managing tokens. The foreignKey column is used
| to make the relationship between the user and the token. You are free to
| use any column name here.
| Uses Redis for managing tokens. We recommend using the "redis" driver
| over the "database" driver when the tokens based auth is the
| primary authentication mode.
|
| Redis ensure that all the expired tokens gets cleaned up automatically.
| Whereas with SQL, you have to cleanup expired tokens manually.
|
| The foreignKey column is used to make the relationship between the user
| and the token. You are free to use any column name here.
|
*/
tokenProvider: {
driver: 'database',
table: 'api_tokens',
driver: 'redis',
redisConnection: 'local',
foreignKey: 'user_id',
},

View File

@@ -6,9 +6,10 @@
*/
import Env from '@ioc:Adonis/Core/Env'
import { OrmConfig } from '@ioc:Adonis/Lucid/Orm'
import { DatabaseConfig } from '@ioc:Adonis/Lucid/Database'
const databaseConfig: DatabaseConfig = {
const databaseConfig: DatabaseConfig & { orm: Partial<OrmConfig> } = {
/*
|--------------------------------------------------------------------------
| Connection
@@ -42,14 +43,26 @@ const databaseConfig: DatabaseConfig = {
password: Env.get('MYSQL_PASSWORD', ''),
database: Env.get('MYSQL_DB_NAME'),
},
migrations: {
naturalSort: true,
},
healthCheck: false,
debug: false,
debug: false,
},
}
},
/*
|--------------------------------------------------------------------------
| 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

59
config/mail.ts Normal file
View File

@@ -0,0 +1,59 @@
/**
* Config source: https://git.io/JvgAf
*
* Feel free to let us know via PR, if you find something broken in this contract
* file.
*/
import Env from '@ioc:Adonis/Core/Env'
import { MailConfig } from '@ioc:Adonis/Addons/Mail'
const mailConfig: MailConfig = {
/*
|--------------------------------------------------------------------------
| Default mailer
|--------------------------------------------------------------------------
|
| The following mailer will be used to send emails, when you don't specify
| a mailer
|
*/
mailer: 'smtp',
/*
|--------------------------------------------------------------------------
| Mailers
|--------------------------------------------------------------------------
|
| You can define or more mailers to send emails from your application. A
| single `driver` can be used to define multiple mailers with different
| config.
|
| For example: Postmark driver can be used to have different mailers for
| sending transactional and promotional emails
|
*/
mailers: {
/*
|--------------------------------------------------------------------------
| Smtp
|--------------------------------------------------------------------------
|
| Uses SMTP protocol for sending email
|
*/
smtp: {
driver: 'smtp',
host: Env.get('SMTP_HOST'),
port: Env.get('SMTP_PORT'),
auth: {
user: Env.get('SMTP_USERNAME'),
pass: Env.get('SMTP_PASSWORD'),
type: 'login',
}
},
},
}
export default mailConfig

View File

@@ -40,7 +40,7 @@ const redisConfig: RedisConfig = {
port: Env.get('REDIS_PORT'),
password: Env.get('REDIS_PASSWORD', ''),
db: Env.get('REDIS_DB', 0),
keyPrefix: '',
keyPrefix: 'artapi:',
healthCheck: true
},
},

View File

@@ -10,7 +10,6 @@ import { SessionConfig } from '@ioc:Adonis/Addons/Session'
const sessionConfig: SessionConfig = {
enabled: true,
/*
|--------------------------------------------------------------------------
| Driver