Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# We try to mock as much as possible so you don't have to have these set to anything real to contribute

# We also only use these variables when you're trying to use the APIs that need them (lazy initialization)

# If you need to work on the feature that uses the API, it must be set.
# If it's mocked in development, then you can set its value to nonsense.
# We'll label them by what feature you need them for and whether it's mocked.

SENTRY_DSN="https://[email protected]/5878963"

SENTRY_AUTH_TOKEN=some_token
SENTRY_ORG=some_org
SENTRY_PROJECT=some_project
Expand All @@ -13,6 +16,7 @@ SENTRY_PROJECT_ID=5878963
# Feature: /contact and /login
# Mocked: yes
# 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

MAILGUN_SENDING_KEY=key-some-mailgun-key
MAILGUN_DOMAIN=some.domain.com

Expand All @@ -27,13 +31,14 @@ TITO_API_SECRET=secret_live_some_long_thing
# Feature: authentication
# Mocked: Unnecessary (any value can be used)
# Technically we have a fallback in development so this doesn't even need to be set

SESSION_SECRET=anything_works_here
MAGIC_LINK_SECRET=whatever_stuff

# Feature: basically everything
# Mocked: No, must run sqlite locally
DATABASE_FILENAME="sqlite.db"
DATABASE_URL="file:./sqlite.db?connection_limit=1"
DATABASE_URL="file:./prisma/sqlite.db"
CACHE_DATABASE_PATH="other/cache.db"
LITEFS_DIR="./prisma"

Expand Down Expand Up @@ -91,4 +96,4 @@ REFRESH_CACHE_SECRET=really_whatever
VERIFIER_API_KEY=some_api_key

# Feature: Cloudflare OAuth
CF_INTERNAL_SECRET=some_long_random_string
CF_INTERNAL_SECRET=some_long_random_string
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules/
tsconfig.tsbuildinfo
/prisma/sqlite.db
/prisma/sqlite.db-journal
/app/utils/prisma-generated.server

other/postcss.ignored

Expand Down
2 changes: 1 addition & 1 deletion app/routes/resources+/webauthn+/verify-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export async function action({ request }: ActionFunctionArgs) {
data: {
id: credential.id,
aaguid,
publicKey: Buffer.from(credential.publicKey),
publicKey: new Uint8Array(credential.publicKey),
userId: user.id,
webauthnUserId,
counter: credential.counter,
Expand Down
10 changes: 9 additions & 1 deletion app/utils/prisma.server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { remember } from '@epic-web/remember'
import { PrismaClient } from '@prisma/client'
import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3'
import chalk from 'chalk'
import pProps from 'p-props'
import { type Session } from '#app/types.ts'
import { ensurePrimary } from '#app/utils/litefs-js.server.ts'
import { decrypt, encrypt } from './encryption.server.ts'
import { PrismaClient } from './prisma-generated.server/client.ts'
import { time, type Timings } from './timing.server.ts'

const logThreshold = 500
Expand All @@ -15,7 +16,14 @@ function getClient(): PrismaClient {
// NOTE: during development if you change anything in this function, remember
// that this only runs once per server restart and won't automatically be
// re-run per request like everything else is.
const url = process.env.DATABASE_URL
if (!url) {
throw new Error(
'DATABASE_URL is required (expected a file: URL for SQLite).',
)
}
const client = new PrismaClient({
adapter: new PrismaBetterSQLite3({ url }),
log: [
{ level: 'query', emit: 'event' },
{ level: 'error', emit: 'stdout' },
Expand Down
2 changes: 1 addition & 1 deletion app/utils/session.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type User } from '@prisma/client'
import { createCookieSessionStorage, redirect } from '@remix-run/node'
import { z } from 'zod'
import { ensurePrimary } from '#app/utils/litefs-js.server.ts'
import { type User } from '#app/utils/prisma-generated.server/client.ts'
import { getLoginInfoSession } from './login.server.ts'
import { getRequiredServerEnvVar } from './misc.tsx'
import {
Expand Down
5 changes: 4 additions & 1 deletion e2e/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import path from 'path'
import { test as base } from '@playwright/test'
import { PrismaClient, type User } from '@prisma/client'
import { parse } from 'cookie'
import fsExtra from 'fs-extra'
import invariant from 'tiny-invariant'
import {
PrismaClient,
type User,
} from '#app/utils/prisma-generated.server/client.ts'
import '../app/entry.server.tsx'
import { getSession } from '../app/utils/session.server.ts'
import { createUser } from '../prisma/seed-utils.ts'
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { config as defaultConfig } from '@epic-web/config/eslint'
/** @type {import("eslint").Linter.Config[]} */
export default [
{
ignores: ['./oauth'],
ignores: ['./oauth', './app/utils/prisma-generated.server'],
},
...defaultConfig,
]
Loading
Loading