Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
feat: drop feather-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Feb 15, 2020
1 parent 83e3cca commit 74de84f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"start": "tasegir run --watch ./src/index.ts"
},
"dependencies": {
"@feathersjs/configuration": "^4.5.1",
"@feathersjs/errors": "^4.5.1",
"@feathersjs/express": "^4.5.1",
"@feathersjs/feathers": "^4.5.1",
Expand Down
3 changes: 0 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import helmet from 'helmet'
import cors from 'cors'

import feathers from '@feathersjs/feathers'
import configuration from '@feathersjs/configuration'
import express from '@feathersjs/express'
import socketio from '@feathersjs/socketio'

Expand All @@ -18,8 +17,6 @@ import blockchain from './blockchain/'

const app: Application = express(feathers())

// Load app configuration
app.configure(configuration())
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet())
app.use(cors())
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logger from './logger'
import app from './app'
import config from 'config'

const port = app.get('port')
const port = config.get('port')
const server = app.listen(port)

process.on('unhandledRejection', (reason, p) =>
logger.error(`Unhandled Rejection at: ${p}\n${reason}`)
)

server.on('listening', () =>
logger.info('Feathers application started on http://%s:%d', app.get('host'), port)
logger.info('Feathers application started on http://%s:%d', config.get('host'), port)
)
3 changes: 2 additions & 1 deletion src/sequelize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Sequelize, SequelizeOptions } from 'sequelize-typescript'
import { Application } from './declarations'
import { factory } from './logger'
import path from 'path'
import config from 'config'

const logger = factory('db')

Expand All @@ -12,7 +13,7 @@ export default function (app: Application): void {
return filename.substring(0, filename.indexOf('.model')) === member.toLowerCase()
},
logging: (sql: string) => logger.debug(sql)
}, app.get('db'))
}, config.get('db'))

const sequelize = new Sequelize(dbSettings)
const oldSetup = app.setup
Expand Down
5 changes: 3 additions & 2 deletions test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import assert from 'assert'
import { Server } from 'http'
import url from 'url'
import axios from 'axios'
import config from 'config'

import app from '../src/app'

const port = app.get('port') || 8998
const port = config.get<number>('port') || 8998
const getUrl = (pathname?: string) => url.format({
hostname: app.get('host') || 'localhost',
hostname: config.get<string>('host') || 'localhost',
protocol: 'http',
port,
pathname
Expand Down

0 comments on commit 74de84f

Please sign in to comment.