Skip to content

Commit 58239a2

Browse files
Refactor: Update environment variables and database configuration
Co-authored-by: me <[email protected]>
1 parent 0262918 commit 58239a2

File tree

3 files changed

+27
-88
lines changed

3 files changed

+27
-88
lines changed

.env.example

Lines changed: 19 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,26 @@
1-
# We try to mock as much as possible so you don't have to have these set to anything real to contribute
2-
# We also only use these variables when you're trying to use the APIs that need them (lazy initialization)
3-
# If you need to work on the feature that uses the API, it must be set.
4-
# If it's mocked in development, then you can set its value to nonsense.
5-
# We'll label them by what feature you need them for and whether it's mocked.
1+
# Copy this file to .env and fill in the values
62

7-
SENTRY_DSN="https://[email protected]/5878963"
8-
SENTRY_AUTH_TOKEN=some_token
9-
SENTRY_ORG=some_org
10-
SENTRY_PROJECT=some_project
11-
SENTRY_PROJECT_ID=5878963
3+
# Session secret for authentication
4+
SESSION_SECRET="your-session-secret-here"
125

13-
# Feature: /contact and /login
14-
# Mocked: yes
15-
# Check the logs which print out the content of every "email" sent for any manual verification you need to do or links you need to open
16-
MAILGUN_SENDING_KEY=key-some-mailgun-key
17-
MAILGUN_DOMAIN=some.domain.com
18-
19-
# Feature: all content pages
20-
# Mocked: yes
21-
BOT_GITHUB_TOKEN=1a2b3c4d5e6f7g8g9i0j
22-
23-
# Feature: workshop pages and blog posts
24-
# Mocked: yes
25-
TITO_API_SECRET=secret_live_some_long_thing
26-
27-
# Feature: authentication
28-
# Mocked: Unnecessary (any value can be used)
29-
# Technically we have a fallback in development so this doesn't even need to be set
30-
SESSION_SECRET=anything_works_here
31-
MAGIC_LINK_SECRET=whatever_stuff
32-
33-
# Feature: basically everything
34-
# Mocked: No, must run sqlite locally
6+
# Database configuration
357
DATABASE_FILENAME="sqlite.db"
36-
DATABASE_URL="file:./sqlite.db?connection_limit=1"
37-
CACHE_DATABASE_PATH="other/cache.db"
38-
LITEFS_DIR="./prisma"
39-
40-
# Feature: Fly
41-
# Mocked: No
42-
FLY_REGION="dfw"
43-
FLY_INSTANCE="123456"
44-
INTERNAL_COMMAND_TOKEN="something_random"
8+
DATABASE_URL="file:./prisma/sqlite.db"
9+
DATABASE_PATH="./prisma/sqlite.db"
4510

46-
# Feature: Call Kent podcast
47-
# Mocked: yes
48-
TRANSISTOR_API_SECRET=something_random
49-
CALL_KENT_PODCAST_ID=12345
50-
51-
# Feature: Discord connection
52-
# Mocked: yes
53-
DISCORD_CLIENT_ID=some_client_id
54-
DISCORD_CLIENT_SECRET=some_discord_secret
55-
DISCORD_SCOPES="identify guilds.join email guilds"
56-
DISCORD_BOT_TOKEN=some_bot_token
57-
DISCORD_GUILD_ID=111122223333444455
58-
DISCORD_RED_ROLE=111122223333444455
59-
DISCORD_YELLOW_ROLE=111122223333444455
60-
DISCORD_BLUE_ROLE=111122223333444455
61-
DISCORD_PRIVATE_BOT_CHANNEL=111122223333444455
62-
DISCORD_ADMIN_USER_ID=111122223333444455
63-
DISCORD_RED_CHANNEL=111122223333444455
64-
DISCORD_BLUE_CHANNEL=111122223333444455
65-
DISCORD_YELLOW_CHANNEL=111122223333444455
66-
DISCORD_PRIVATE_BOT_CHANNEL=111122223333444455
67-
DISCORD_LEADERBOARD_CHANNEL=111122223333444455
68-
DISCORD_CALL_KENT_CHANNEL=111122223333444455
69-
DISCORD_MEMBER_ROLE=111122223333444455
70-
71-
# Feature: /sign-up
72-
# Mocked: yes
73-
KIT_API_KEY=some_api_key
74-
KIT_API_SECRET=some_api_secret
75-
76-
# Feature: /chats
77-
# Mocked: yes
78-
SIMPLECAST_KEY=some_simplecast_key
79-
CHATS_WITH_KENT_PODCAST_ID=some_podcast_id
80-
81-
# Feature: /blog
82-
# Mocked: yes
83-
TWITTER_BEARER_TOKEN=MOCK_TWITTER_TOKEN
11+
# Cache database
12+
CACHE_DATABASE_PATH="other/cache.db"
8413

85-
# Feature: /action/refresh-cache
86-
# Mocked: unnecessary (any value can be used)
87-
REFRESH_CACHE_SECRET=really_whatever
14+
# Sentry configuration
15+
SENTRY_DSN="https://[email protected]/123456"
16+
SENTRY_PROJECT_ID="your-project-id"
17+
SENTRY_HOST="your-sentry-host"
18+
SENTRY_ORG="your-sentry-org"
19+
SENTRY_PROJECT="your-sentry-project"
20+
SENTRY_AUTH_TOKEN="your-sentry-auth-token"
8821

89-
# /login
90-
# Mocked: yes
91-
VERIFIER_API_KEY=some_api_key
22+
# LiteFS configuration
23+
LITEFS_DIR="./litefs"
9224

93-
# Feature: Cloudflare OAuth
94-
CF_INTERNAL_SECRET=some_long_random_string
25+
# Other environment variables
26+
NODE_ENV="development"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ tsconfig.tsbuildinfo
1212
/prisma/sqlite.db-journal
1313
/prisma/dev.db
1414
/prisma/dev.db-journal
15+
/prisma/*.db*
16+
/prisma/*-journal
1517

1618
other/postcss.ignored
1719

prisma/seed.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { PrismaClient } from '@prisma/client'
2+
import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3'
23
import { subMonths } from 'date-fns'
34

4-
const prisma = new PrismaClient()
5+
const prisma = new PrismaClient({
6+
adapter: new PrismaBetterSQLite3({
7+
url: process.env.DATABASE_URL!,
8+
}),
9+
})
510

611
async function main() {
712
const kent = await prisma.user.upsert({

0 commit comments

Comments
 (0)