feat: bootstrap admin user on first run
This commit is contained in:
@@ -8,6 +8,10 @@ cd "$(dirname "$0")"
|
||||
BUMP="${1:-patch}"
|
||||
[ -z "$(git status --porcelain)" ] || { echo "working tree dirty, commit first"; exit 1; }
|
||||
|
||||
# verify we can push BEFORE bumping — otherwise a failed push leaves the
|
||||
# version advanced locally with nothing on the remote.
|
||||
git push --dry-run >/dev/null 2>&1 || { echo "git push auth failed — fix your remote/credentials before bumping"; exit 1; }
|
||||
|
||||
# bumps version in package.json AND creates commit + tag vX.Y.Z
|
||||
bun pm version "$BUMP"
|
||||
git push --follow-tags
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@ import { building, dev } from '$app/environment';
|
||||
import { getAuth } from '$lib/auth/server';
|
||||
import { getTextDirection } from '$lib/paraglide/runtime';
|
||||
import { paraglideMiddleware } from '$lib/paraglide/server';
|
||||
import { db } from '$lib/server/db';
|
||||
import { getConfig } from '$lib/server/config';
|
||||
import { db } from '$lib/server/db';
|
||||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
|
||||
@@ -34,11 +34,11 @@ export const init: ServerInit = async () => {
|
||||
|
||||
await getAuth().api.createUser({
|
||||
body: {
|
||||
data: { displayUsername: username, emailVerified: true, username },
|
||||
email,
|
||||
name: username,
|
||||
password,
|
||||
role: 'admin',
|
||||
data: { username, displayUsername: username, emailVerified: true }
|
||||
role: 'admin'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user