Skip to content

Commit

Permalink
🧑‍💻 Improve env variables type safety and management
Browse files Browse the repository at this point in the history
Closes #679
  • Loading branch information
baptisteArno committed Aug 27, 2023
1 parent a23a8c4 commit 437528e
Show file tree
Hide file tree
Showing 15 changed files with 1,435 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .env.dev.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Make sure to change this to your own random string of 32 characters (https://docs.typebot.io/self-hosting/docker#2-add-the-required-configuration)
ENCRYPTION_SECRET=H+KbL/OFrqbEuDy/1zX8bsPG+spXri3S

DATABASE_URL=postgresql://postgres:typebot@localhost:5432/typebot

NEXTAUTH_URL=http://localhost:3000
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001

GITHUB_CLIENT_ID=534b549dd17709a743a2
GITHUB_CLIENT_SECRET=7adb03507504fb1a54422f6c3c697277cfd000a9

S3_ACCESS_KEY=minio
S3_SECRET_KEY=minio123
S3_BUCKET=typebot
S3_PORT=9000
S3_ENDPOINT=localhost
S3_SSL=false

# For more configuration options check out: https://docs.typebot.io/self-hosting/configuration
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Make sure to change this to your own random string of 32 characters (https://docs.typebot.io/self-hosting/docker#2-add-the-required-configuration)
ENCRYPTION_SECRET=do+UspMmB/rewbX2K/rskFmtgGSSZ8Ta

DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot

NEXTAUTH_URL=
NEXT_PUBLIC_VIEWER_URL=

ADMIN_EMAIL=
# For more configuration options check out: https://docs.typebot.io/self-hosting/configuration
61 changes: 61 additions & 0 deletions apps/builder/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { withSentryConfig } from '@sentry/nextjs'
import { join, dirname } from 'path'
import '@typebot.io/env/dist/env.mjs'
import { configureRuntimeEnv } from 'next-runtime-env/build/configure.js'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)

const __dirname = dirname(__filename)

configureRuntimeEnv()

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
transpilePackages: [
'@typebot.io/lib',
'@typebot.io/schemas',
'@typebot.io/emails',
'@typebot.io/env',
],
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr', 'pt', 'de'],
},
experimental: {
outputFileTracingRoot: join(__dirname, '../../'),
},
headers: async () => {
return [
{
source: '/(.*)?',
headers: [
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
],
},
]
},
}

const sentryWebpackPluginOptions = {
silent: true,
release: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA + '-builder',
}

export default process.env.NEXT_PUBLIC_SENTRY_DSN
? withSentryConfig(
{
...nextConfig,
sentry: {
hideSourceMaps: true,
widenClientFileUpload: true,
},
},
sentryWebpackPluginOptions
)
: nextConfig
291 changes: 291 additions & 0 deletions apps/docs/docs/self-hosting/configuration.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions apps/docs/docs/self-hosting/guides/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Guides",
"position": 3
}
Loading

0 comments on commit 437528e

Please sign in to comment.