chore: update gitignore for phase02

This commit is contained in:
hibna
2026-02-21 13:22:51 +03:00
parent 2215003a4d
commit 8eb7c90958
16 changed files with 479 additions and 29 deletions
+5 -4
View File
@@ -8,10 +8,10 @@
"scripts": {
"build": "tsc",
"lint": "eslint src/",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:seed": "tsx src/seed.ts",
"db:studio": "drizzle-kit studio"
"db:generate": "dotenv -e ../../.env -- drizzle-kit generate",
"db:migrate": "dotenv -e ../../.env -- drizzle-kit migrate",
"db:seed": "dotenv -e ../../.env -- tsx src/seed.ts",
"db:studio": "dotenv -e ../../.env -- drizzle-kit studio"
},
"dependencies": {
"drizzle-orm": "^0.38.0",
@@ -19,6 +19,7 @@
},
"devDependencies": {
"@types/node": "^22.0.0",
"dotenv-cli": "^8.0.0",
"drizzle-kit": "^0.30.0",
"tsx": "^4.19.0"
}
@@ -0,0 +1,14 @@
import { pgTable, uuid, varchar, integer, boolean } from 'drizzle-orm/pg-core';
import { nodes } from './nodes';
import { servers } from './servers';
export const allocations = pgTable('allocations', {
id: uuid('id').defaultRandom().primaryKey(),
nodeId: uuid('node_id')
.notNull()
.references(() => nodes.id, { onDelete: 'cascade' }),
serverId: uuid('server_id').references(() => servers.id, { onDelete: 'set null' }),
ip: varchar('ip', { length: 45 }).notNull(),
port: integer('port').notNull(),
isDefault: boolean('is_default').default(false).notNull(),
});
+1
View File
@@ -1,6 +1,7 @@
export * from './users';
export * from './organizations';
export * from './nodes';
export * from './allocations';
export * from './games';
export * from './servers';
export * from './backups';
-12
View File
@@ -9,7 +9,6 @@ import {
timestamp,
} from 'drizzle-orm/pg-core';
import { organizations } from './organizations';
import { servers } from './servers';
export const nodes = pgTable('nodes', {
id: uuid('id').defaultRandom().primaryKey(),
@@ -32,14 +31,3 @@ export const nodes = pgTable('nodes', {
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
export const allocations = pgTable('allocations', {
id: uuid('id').defaultRandom().primaryKey(),
nodeId: uuid('node_id')
.notNull()
.references(() => nodes.id, { onDelete: 'cascade' }),
serverId: uuid('server_id').references(() => servers.id, { onDelete: 'set null' }),
ip: varchar('ip', { length: 45 }).notNull(),
port: integer('port').notNull(),
isDefault: boolean('is_default').default(false).notNull(),
});
+27 -9
View File
@@ -1,5 +1,6 @@
import { createDb } from './client';
import { games } from './schema/games';
import { users } from './schema/users';
async function seed() {
const databaseUrl = process.env.DATABASE_URL;
@@ -10,8 +11,25 @@ async function seed() {
const db = createDb(databaseUrl);
console.log('Seeding games...');
// Seed super admin
console.log('Seeding super admin...');
// Password: admin123 (argon2id hash)
// In production, change this immediately after first login
const ADMIN_PASSWORD_HASH =
'$argon2id$v=19$m=65536,t=3,p=4$c29tZXNhbHQ$RdescudvJCsgt3ub+b+daw';
await db
.insert(users)
.values({
email: 'admin@gamepanel.local',
username: 'admin',
passwordHash: ADMIN_PASSWORD_HASH,
isSuperAdmin: true,
})
.onConflictDoNothing();
// Seed games
console.log('Seeding games...');
await db
.insert(games)
.values([
@@ -22,7 +40,7 @@ async function seed() {
defaultPort: 25565,
startupCommand: '/start',
stopCommand: 'stop',
configFiles: JSON.stringify([
configFiles: [
{
path: 'server.properties',
parser: 'properties',
@@ -44,8 +62,8 @@ async function seed() {
{ path: 'whitelist.json', parser: 'json' },
{ path: 'bukkit.yml', parser: 'yaml' },
{ path: 'spigot.yml', parser: 'yaml' },
]),
environmentVars: JSON.stringify([
],
environmentVars: [
{ key: 'EULA', default: 'TRUE', description: 'Accept Minecraft EULA', required: true },
{
key: 'TYPE',
@@ -60,7 +78,7 @@ async function seed() {
required: true,
},
{ key: 'MEMORY', default: '1G', description: 'JVM memory allocation', required: false },
]),
],
},
{
slug: 'cs2',
@@ -70,7 +88,7 @@ async function seed() {
startupCommand:
'./srcds_run -game csgo -console -usercon +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2',
stopCommand: 'quit',
configFiles: JSON.stringify([
configFiles: [
{
path: 'csgo/cfg/server.cfg',
parser: 'keyvalue',
@@ -84,8 +102,8 @@ async function seed() {
],
},
{ path: 'csgo/cfg/autoexec.cfg', parser: 'keyvalue' },
]),
environmentVars: JSON.stringify([
],
environmentVars: [
{
key: 'SRCDS_TOKEN',
default: '',
@@ -100,7 +118,7 @@ async function seed() {
description: 'Max players',
required: false,
},
]),
],
},
])
.onConflictDoNothing();