Skip to content

Commit 108e4d1

Browse files
committed
✨ feat: push working state
1 parent ab1aa7f commit 108e4d1

File tree

6 files changed

+204
-192
lines changed

6 files changed

+204
-192
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ RUN chown -R bun:bun .
4343
USER bun
4444
ENV NODE_ENV=production
4545
EXPOSE 3000/tcp
46+
EXPOSE 3388/tcp
4647
# TODO
4748
# HEALTHCHECK --interval=15s --timeout=10s --retries=3 CMD curl -f http://0.0.0.0:3000/api/health/ready || exit 1
4849
CMD ["sh", "-c", "bunx drizzle-kit migrate && bun ./index.js"]

bun.lock

Lines changed: 119 additions & 111 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
{
22
"devDependencies": {
33
"@eslint/compat": "^1.3.1",
4-
"@eslint/js": "^9.30.1",
4+
"@eslint/js": "^9.32.0",
55
"@inlang/cli": "^3.0.12",
66
"@inlang/paraglide-js": "2.2.0",
77
"@lucide/svelte": "^0.525.0",
88
"@m1212e/graphql-scalars-houdini": "^0.0.1",
9-
"@m1212e/konfigure": "^0.0.8",
9+
"@m1212e/konfigure": "^0.0.10",
1010
"@m1212e/rumble": "^0.8.4",
1111
"@m1212e/sveltekit-oidc": "^0.0.33",
12-
"@sinclair/typebox": "^0.34.37",
13-
"@skeletonlabs/skeleton": "^3.1.4",
14-
"@skeletonlabs/skeleton-svelte": "^1.2.4",
15-
"@sveltejs/adapter-node": "^5.2.12",
16-
"@sveltejs/kit": "^2.22.2",
17-
"@sveltejs/vite-plugin-svelte": "^5.1.0",
12+
"@sinclair/typebox": "^0.34.38",
13+
"@skeletonlabs/skeleton": "^3.1.7",
14+
"@skeletonlabs/skeleton-svelte": "^1.3.1",
15+
"@sveltejs/adapter-node": "^5.2.13",
16+
"@sveltejs/kit": "2.21.0",
17+
"@sveltejs/vite-plugin-svelte": "^6.1.0",
1818
"@tailwindcss/typography": "^0.5.16",
1919
"@tailwindcss/vite": "^4.1.11",
20-
"@types/bun": "^1.2.18",
20+
"@types/bun": "^1.2.19",
2121
"@types/mailparser": "^3.4.6",
2222
"@types/pg": "^8.15.4",
2323
"@types/smtp-server": "^3.5.10",
2424
"concurrently": "^9.2.0",
2525
"drizzle-seed": "^0.3.1-c0277c0",
26-
"eslint": "^9.29.0",
27-
"eslint-config-prettier": "^10.1.5",
28-
"eslint-plugin-svelte": "^3.10.1",
26+
"eslint": "^9.32.0",
27+
"eslint-config-prettier": "^10.1.8",
28+
"eslint-plugin-svelte": "^3.11.0",
2929
"graphql": "^16.11.0",
3030
"graphql-sse": "^2.5.4",
31-
"houdini": "^1.5.8",
32-
"houdini-svelte": "^2.1.18",
33-
"lefthook": "^1.11.16",
31+
"houdini": "^1.5.9",
32+
"houdini-svelte": "^2.1.19",
33+
"lefthook": "^1.12.2",
3434
"lucide-svelte": "^0.525.0",
3535
"mailparser": "^3.7.4",
3636
"nanoid": "^5.1.5",
3737
"prettier": "^3.6.2",
3838
"prettier-plugin-svelte": "^3.4.0",
39-
"prettier-plugin-tailwindcss": "^0.6.13",
39+
"prettier-plugin-tailwindcss": "^0.6.14",
4040
"smtp-server": "^3.14.0",
41-
"svelte": "^5.35.2",
42-
"svelte-check": "^4.2.2",
41+
"svelte": "^5.36.16",
42+
"svelte-check": "^4.3.0",
4343
"svelte-french-toast": "1.2.0",
4444
"tailwindcss": "^4.1.11",
4545
"typescript": "^5.8.3",
46-
"typescript-eslint": "^8.35.1",
47-
"vite": "^7.0.2"
46+
"typescript-eslint": "^8.38.0",
47+
"vite": "^7.0.6"
4848
},
4949
"name": "project",
5050
"private": true,

src/api/db/schema.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import { nanoid } from '../../lib/helpers/nanoid';
2-
import {
3-
pgTable,
4-
text,
5-
timestamp,
6-
unique,
7-
pgEnum,
8-
boolean,
9-
smallint,
10-
type AnyPgColumn
11-
} from 'drizzle-orm/pg-core';
2+
import { pgTable, text, timestamp } from 'drizzle-orm/pg-core';
123

134
const defaultTimestamps = {
145
createdAt: timestamp().defaultNow().notNull(),

src/lib/config/private.ts

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
import { env } from '$env/dynamic/private';
2-
import { konfigure, sources } from '@m1212e/konfigure';
2+
import { konfigure } from '@m1212e/konfigure';
3+
import { object } from '@m1212e/konfigure/source/object.js';
34
import { Type } from '@sinclair/typebox';
45
import { configPublic } from './public';
6+
import { building } from '$app/environment';
57

6-
export const configPrivate = await konfigure({
7-
delimeter: 'disabled',
8-
schema: Type.Object({
9-
DATABASE_URL: Type.String(),
10-
OIDC_CLIENT_SECRET: Type.Optional(Type.String()),
11-
OIDC_SCOPES: Type.Optional(Type.String()),
12-
NODE_ENV: Type.Optional(
13-
Type.Union([Type.Literal('development'), Type.Literal('production'), Type.Literal('test')])
14-
),
15-
SECRET: Type.Optional(Type.String()),
16-
PORT: Type.Optional(Type.Number()),
17-
HOST: Type.Optional(Type.String()),
18-
SMTP_PORT: Type.Number({ default: 3388 }),
19-
SMTP_HOST: Type.String({ default: '0.0.0.0' }),
20-
NTFY_HOST: Type.Optional(Type.String()),
21-
// ntfy.sh max topic length is 65
22-
TOPIC_LENGTH: Type.Integer({ default: 65, minimum: 30 })
23-
}),
24-
sources: [
25-
sources.object(env),
26-
sources.dockerSecrets(),
27-
sources.yamlFile('./config.yaml'),
28-
sources.tomlFile('./config.toml'),
29-
sources.jsonFile('./config.json')
30-
]
31-
});
8+
function readConfig() {
9+
return konfigure({
10+
delimeter: 'disabled',
11+
schema: Type.Object({
12+
DATABASE_URL: Type.String(),
13+
OIDC_CLIENT_SECRET: Type.Optional(Type.String()),
14+
OIDC_SCOPES: Type.Optional(Type.String()),
15+
NODE_ENV: Type.Optional(
16+
Type.Union([Type.Literal('development'), Type.Literal('production'), Type.Literal('test')])
17+
),
18+
SECRET: Type.Optional(Type.String()),
19+
PORT: Type.Optional(Type.Number()),
20+
HOST: Type.Optional(Type.String()),
21+
SMTP_PORT: Type.Number({ default: 3388 }),
22+
SMTP_HOST: Type.String({ default: '0.0.0.0' }),
23+
NTFY_HOST: Type.Optional(Type.String()),
24+
// ntfy.sh max topic length is 65
25+
TOPIC_LENGTH: Type.Integer({ default: 65, minimum: 30 })
26+
}),
27+
sources: [object(env)]
28+
});
29+
}
30+
31+
export const configPrivate = building
32+
? ({} as Awaited<ReturnType<typeof readConfig>>)
33+
: await readConfig();
3234

33-
const minAmountOfRandomTopicChars = 30;
34-
if (
35-
configPrivate.TOPIC_LENGTH - configPublic.PUBLIC_TOPIC_PREFIX.length <=
36-
minAmountOfRandomTopicChars
37-
) {
38-
throw new Error(
39-
`Your prefix is too long! Please reduce it by ${minAmountOfRandomTopicChars - (configPrivate.TOPIC_LENGTH - configPublic.PUBLIC_TOPIC_PREFIX.length) + 1} chars!`
40-
);
35+
if (!building) {
36+
const minAmountOfRandomTopicChars = 30;
37+
if (
38+
configPrivate.TOPIC_LENGTH - configPublic.PUBLIC_TOPIC_PREFIX.length <=
39+
minAmountOfRandomTopicChars
40+
) {
41+
throw new Error(
42+
`Your prefix is too long! Please reduce it by ${minAmountOfRandomTopicChars - (configPrivate.TOPIC_LENGTH - configPublic.PUBLIC_TOPIC_PREFIX.length) + 1} chars!`
43+
);
44+
}
4145
}

src/lib/config/public.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1+
import { building } from '$app/environment';
12
import { env } from '$env/dynamic/public';
2-
import { konfigure, sources } from '@m1212e/konfigure';
3+
import { konfigure } from '@m1212e/konfigure';
4+
import { object } from '@m1212e/konfigure/source/object.js';
35
import { Type } from '@sinclair/typebox';
46

5-
export const configPublic = await konfigure({
6-
delimeter: 'disabled',
7-
schema: Type.Object({
8-
PUBLIC_VERSION: Type.Optional(Type.String()),
9-
PUBLIC_SHA: Type.Optional(Type.String()),
10-
PUBLIC_OIDC_AUTHORITY: Type.String(),
11-
PUBLIC_OIDC_CLIENT_ID: Type.String(),
12-
PUBLIC_DEFAULT_LOCALE: Type.String({ default: 'en' }),
13-
PUBLIC_OIDC_LOGIN_CALLBACK_ROUTE: Type.Optional(Type.String()),
14-
PUBLIC_OIDC_LOGOUT_CALLBACK_ROUTE: Type.Optional(Type.String()),
15-
PUBLIC_NTFY_HOST: Type.String({ default: 'https://ntfy.sh' }),
16-
PUBLIC_TOPIC_PREFIX: Type.String({ default: '' })
17-
}),
18-
sources: [sources.object(env)]
19-
});
7+
function readConfig() {
8+
return konfigure({
9+
delimeter: 'disabled',
10+
schema: Type.Object({
11+
PUBLIC_VERSION: Type.Optional(Type.String()),
12+
PUBLIC_SHA: Type.Optional(Type.String()),
13+
PUBLIC_OIDC_AUTHORITY: Type.String(),
14+
PUBLIC_OIDC_CLIENT_ID: Type.String(),
15+
PUBLIC_DEFAULT_LOCALE: Type.String({ default: 'en' }),
16+
PUBLIC_OIDC_LOGIN_CALLBACK_ROUTE: Type.Optional(Type.String()),
17+
PUBLIC_OIDC_LOGOUT_CALLBACK_ROUTE: Type.Optional(Type.String()),
18+
PUBLIC_NTFY_HOST: Type.String({ default: 'https://ntfy.sh' }),
19+
PUBLIC_TOPIC_PREFIX: Type.String({ default: '' })
20+
}),
21+
sources: [object(env)]
22+
});
23+
}
24+
25+
export const configPublic = building
26+
? ({} as Awaited<ReturnType<typeof readConfig>>)
27+
: await readConfig();

0 commit comments

Comments
 (0)