Skip to content

Commit

Permalink
Adding types and better logging (#822)
Browse files Browse the repository at this point in the history
* Saving

* Move and convert to ts

* add module attribute

* Saving

* Rename

* Rename
  • Loading branch information
drazisil committed Feb 22, 2021
1 parent d4e0094 commit 86a4940
Show file tree
Hide file tree
Showing 31 changed files with 705 additions and 456 deletions.
51 changes: 0 additions & 51 deletions app.js

This file was deleted.

46 changes: 46 additions & 0 deletions app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
mco-server is a game server, written from scratch, for an old game
Copyright (C) <2017-2018> <Joseph W Becher>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { appSettings } from './config/app-settings'
import { logger } from './src/shared/logger'
import { AuthLogin } from './src/services/AuthLogin/AuthLogin'
import { PatchServer } from './src/services/PatchAndShard/patchServer'
import { Server } from './src/server'
import { DatabaseManager, doMigrations } from './src/shared/DatabaseManager'

// Database manager
const dbLogger = logger.child({ service: 'mcoserver:DatabaseManager' })
const databaseManager = new DatabaseManager(dbLogger)
doMigrations(dbLogger)

// MCOS Monolith
const server = new Server(databaseManager)

// MCOS PatchAndShard
const patchAndShardServer = new PatchServer(
logger.child({ service: 'mcoserver:PatchServer' })
)

// MCOS AuthLogin and Shard
const authLogin = new AuthLogin(appSettings)

Promise.all(
[server.start(),
patchAndShardServer.start(),
authLogin.start()]
).then(
() => {
logger.info('All servers started successfully')
}
)
.catch(
(err) => {
logger.error(`There was an error starting the server: ${err}`)
process.exit(-1)
}
)
172 changes: 0 additions & 172 deletions docs/reference/structures.js

This file was deleted.

4 changes: 2 additions & 2 deletions migrations/1-2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
CREATE TABLE "sessions"
(
customer_id integer,
session_key text NOT NULL,
s_key text NOT NULL,
sessionkey text NOT NULL,
skey text NOT NULL,
context_id text NOT NULL,
connection_id text NOT NULL,
CONSTRAINT pk_session PRIMARY KEY (customer_id)
Expand Down
24 changes: 16 additions & 8 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 86a4940

Please sign in to comment.