Skip to content

Commit

Permalink
feat: add email testing SMTP server (inbucket)
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed May 18, 2021
1 parent 98931cc commit 8859a93
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
10 changes: 9 additions & 1 deletion src/commands/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
process.exit(1)
}

const { kongPort, dbPort } = await ask([
const { kongPort, dbPort, mailPort } = await ask([
{
type: 'input',
name: 'kongPort',
Expand All @@ -32,6 +32,12 @@ export default {
message: 'Port for PostgreSQL database:',
initial: '5432',
},
{
type: 'input',
name: 'mailPort',
message: 'Port for email testing interface:',
initial: '9000',
},
])

const anonApiKey =
Expand All @@ -57,6 +63,7 @@ export default {
props: {
kongPort,
dbPort,
mailPort,
anonApiKey,
serviceRoleApiKey,
},
Expand All @@ -72,6 +79,7 @@ export default {
Supabase Key (anon, public): ${highlight(anonApiKey)}
Supabase Key (service_role, private): ${highlight(serviceRoleApiKey)}
Database URL: ${highlight(`postgres://postgres:postgres@localhost:${dbPort}/postgres`)}
Email testing interface URL: ${highlight(`http://localhost:${mailPort}`)}
`)
},
}
10 changes: 9 additions & 1 deletion src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
}
}

const { kongPort, dbPort } = await ask([
const { kongPort, dbPort, mailPort } = await ask([
{
type: 'input',
name: 'kongPort',
Expand All @@ -55,6 +55,12 @@ export default {
message: 'Port for PostgreSQL database:',
initial: '5432',
},
{
type: 'input',
name: 'mailPort',
message: 'Port for email testing interface:',
initial: '9000',
},
])

const anonApiKey =
Expand All @@ -81,6 +87,7 @@ export default {
props: {
kongPort,
dbPort,
mailPort,
anonApiKey,
serviceRoleApiKey,
},
Expand All @@ -106,6 +113,7 @@ export default {
Supabase Key (anon, public): ${highlight(anonApiKey)}
Supabase Key (service_role, private): ${highlight(serviceRoleApiKey)}
Database URL: ${highlight(`postgres://postgres:postgres@localhost:${dbPort}/postgres`)}
Email testing interface URL: ${highlight(`http://localhost:${mailPort}`)}
Run ${highlight('supabase start')} to start local Supabase.
`)
Expand Down
28 changes: 23 additions & 5 deletions src/templates/init/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,30 @@ services:
GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
GOTRUE_DB_DRIVER: postgres
DB_NAMESPACE: auth
API_EXTERNAL_URL: localhost
GOTRUE_API_HOST: 0.0.0.0
API_EXTERNAL_URL: http://localhost:8000
GOTRUE_API_HOST: auth
PORT: 9999
GOTRUE_DISABLE_SIGNUP: 'false'
GOTRUE_SITE_URL: localhost
GOTRUE_MAILER_AUTOCONFIRM: 'true'
GOTRUE_SITE_URL: http://localhost:8000
GOTRUE_SMTP_HOST: mail
GOTRUE_SMTP_PORT: 2500
GOTRUE_SMTP_USER: GOTRUE_SMTP_USER
GOTRUE_SMTP_PASS: GOTRUE_SMTP_PASS
GOTRUE_SMTP_ADMIN_EMAIL: [email protected]
GOTRUE_MAILER_AUTOCONFIRM: 'false'
GOTRUE_MAILER_SUBJECTS_CONFIRMATION: Confirm Your Signup
GOTRUE_MAILER_SUBJECTS_INVITE: You have been invited
GOTRUE_MAILER_SUBJECTS_MAGIC_LINK: Your Magic Link
GOTRUE_MAILER_SUBJECTS_RECOVERY: Reset Your Password
GOTRUE_MAILER_URLPATHS_CONFIRMATION: /auth/v1/verify
GOTRUE_MAILER_URLPATHS_INVITE: /auth/v1/verify
GOTRUE_MAILER_URLPATHS_RECOVERY: /auth/v1/verify
GOTRUE_LOG_LEVEL: DEBUG
GOTRUE_OPERATOR_TOKEN: super-secret-operator-token
DATABASE_URL: 'postgres://postgres:postgres@db:5432/postgres?sslmode=disable'
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres?sslmode=disable
depends_on:
- db
- mail
rest:
container_name: supabase-rest
image: postgrest/postgrest:latest
Expand Down Expand Up @@ -74,3 +87,8 @@ services:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
mail:
container_name: supabase-mail
image: inbucket/inbucket:stable
ports:
- <%= props.mailPort %>:9000
12 changes: 11 additions & 1 deletion src/templates/init/docker/kong/kong.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
_format_version: '1.1'
services:
- name: auth-v1-open
_comment: 'GoTrue: /auth/v1/verify* -> http://auth:9999/verify*'
url: http://auth:9999/verify
routes:
- name: auth-v1-open
strip_path: true
paths:
- /auth/v1/verify
plugins:
- name: cors
- name: auth-v1
_comment: 'GoTrue: /auth/v1/* -> http://auth:9999/*'
url: http://auth:9999/
routes:
- name: auth-v1-all
- name: auth-v1
strip_path: true
paths:
- /auth/v1/
Expand Down

0 comments on commit 8859a93

Please sign in to comment.