Skip to content

Commit

Permalink
chore: add brevo config
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Dec 15, 2024
1 parent 9610b2f commit 8bedd5b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 33 deletions.
2 changes: 2 additions & 0 deletions apps/romainlanz.com/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=

# Mail
MAIL_DRIVER=smtp
SMTP_HOST=127.0.0.1
SMTP_PORT=1025
BREVO_API_KEY=
16 changes: 6 additions & 10 deletions apps/romainlanz.com/config/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig, transports } from '@adonisjs/mail';
import env from '#start/env';

const mailConfig = defineConfig({
default: 'smtp',
default: env.get('MAIL_DRIVER'),

from: '[email protected]',

Expand All @@ -15,15 +15,11 @@ const mailConfig = defineConfig({
smtp: transports.smtp({
host: env.get('SMTP_HOST'),
port: env.get('SMTP_PORT'),
/**
* Uncomment the auth block if your SMTP
* server needs authentication
*/
/* Auth: {
type: 'login',
user: env.get('SMTP_USERNAME'),
pass: env.get('SMTP_PASSWORD'),
}, */
}),

brevo: transports.brevo({
baseUrl: 'https://api.brevo.com/v3',
key: env.get('BREVO_API_KEY'),
}),
},
});
Expand Down
36 changes: 13 additions & 23 deletions apps/romainlanz.com/start/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,35 @@
import { Env } from '@adonisjs/core/env';

export default await Env.create(new URL('../', import.meta.url), {
NODE_ENV: Env.schema.enum(['development', 'production', 'test'] as const),
// Node
TZ: Env.schema.string(),
PORT: Env.schema.number(),
APP_URL: Env.schema.string(),
APP_KEY: Env.schema.string(),
HOST: Env.schema.string({ format: 'host' }),
NODE_ENV: Env.schema.enum(['development', 'production', 'test'] as const),

// App
LOG_LEVEL: Env.schema.string(),
APP_KEY: Env.schema.string(),
APP_URL: Env.schema.string(),
REDIRECT_DOMAIN: Env.schema.string(),

/*
|----------------------------------------------------------
| Variables for configuring session package
|----------------------------------------------------------
*/
// Session
SESSION_DRIVER: Env.schema.enum(['cookie', 'memory'] as const),

/*
|----------------------------------------------------------
| Variables for configuring database connection
|----------------------------------------------------------
*/
// Database
DB_HOST: Env.schema.string({ format: 'host' }),
DB_PORT: Env.schema.number(),
DB_USER: Env.schema.string(),
DB_PASSWORD: Env.schema.string.optional(),
DB_DATABASE: Env.schema.string(),

/*
|----------------------------------------------------------
| Variables for configuring Twitch API
|----------------------------------------------------------
*/
// Twitch
TWITCH_CLIENT_ID: Env.schema.string(),
TWITCH_CLIENT_SECRET: Env.schema.string(),

/*
|----------------------------------------------------------
| Variables for configuring the mail package
|----------------------------------------------------------
*/
// Mail
MAIL_DRIVER: Env.schema.enum(['smtp', 'brevo'] as const),
SMTP_HOST: Env.schema.string(),
SMTP_PORT: Env.schema.string(),
BREVO_API_KEY: Env.schema.string(),
});

0 comments on commit 8bedd5b

Please sign in to comment.