Skip to content

Commit

Permalink
Add Hapi-Anchor-Model (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregfrasco committed Jun 27, 2018
1 parent c0307bd commit fa766f6
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 757 deletions.
20 changes: 13 additions & 7 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ const config = {
local: process.env.AUTH_SECRET,
$default: '!k3yb04rdK4tz~4qu4~k3yb04rdd0gz!'
},
hapiMongoModels: {
hapiAnchorModel: {
mongodb: {
uri: {
$filter: 'env',
production: process.env.MONGODB_URI,
test: 'mongodb://localhost:27017/anchor-test',
local: process.env.MONGODB_URI,
$default: 'mongodb://localhost:27017/anchor'
connection: {
uri: {
$filter: 'env',
production: process.env.MONGODB_URI,
$default: 'mongodb://localhost:27017/'
},
db: {
$filter: 'env',
production: process.env.MONGODB_DB_NAME,
test: 'anchor-test',
$default: 'anchor'
}
}
},
autoIndex: true
Expand Down
234 changes: 11 additions & 223 deletions manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,233 +13,21 @@ const manifest = {
debug: {
request: ['error']
},
connections: {
routes: {
security: true
}
}
},
connections: [{
port: Config.get('/port/web'),
labels: ['web'],
routes: { cors: true }
}],
registrations: [
{
plugin: 'hapi-auth-basic'
},
{
plugin: 'hapi-auth-cookie'
},
{
plugin: 'hapi-auth-jwt2'
},
{
plugin: 'lout'
routes: {
security: true
},
{
plugin: 'inert'
},
{
plugin: 'vision'
},
{
plugin: {
register: 'visionary',
options: {
engines: { handlebars: 'handlebars' },
path: './server/web/templates',
layout: 'layout',
layoutPath: './server/web/layouts',
partialsPath: './server/web/partials',
helpersPath: './server/web/helpers'
}
}
},
{
plugin: {
register: 'hicsail-hapi-mongo-models',
options: {
mongodb: Config.get('/hapiMongoModels/mongodb'),
models: {
AuthAttempt: './server/models/auth-attempt',
Backup: './server/models/backup',
Event: './server/models/event',
Feedback: './server/models/feedback',
Invite: './server/models/invite',
Session: './server/models/session',
Token: './server/models/token',
User: './server/models/user'
},
autoIndex: Config.get('/hapiMongoModels/autoIndex')
}
}
},
{
plugin: {
register: 'hapi-cron',
port: Config.get('/port/web')
},
register: {
plugins: [
{
plugin: './server/anchor/hapi-anchor-model.js',
options: {
jobs: [{
name: 'backup',
time: '0 0 * * * *', //every hour
timezone: 'America/New_York',
request: {
method: 'POST',
url: '/api/backups/internal',
allowInternals: true
}
}]
mongodb: Config.get('/hapiAnchorModel/mongodb')
}
}
},
{
plugin: './server/auth'
},
{
plugin: './server/mailer'
},
{
plugin: './server/api/auth-attempts',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/backups',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/clinician',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/contact',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/env',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/events',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/feedback',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/index',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/invites',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/login',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/logout',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/sessions',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/signup',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/tokens',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/api/users',
options: {
routes: { prefix: '/api' }
}
},
{
plugin: './server/web/routes/account'
},
{
plugin: './server/web/routes/authAttempts'
},
{
plugin: './server/web/routes/backup'
},
{
plugin: './server/web/routes/clinician'
},
{
plugin: './server/web/routes/dashboard'
},
{
plugin: './server/web/routes/events'
},
{
plugin: './server/web/routes/env'
},
{
plugin: './server/web/routes/feedback'
},
{
plugin: './server/web/routes/index'
},
{
plugin: './server/web/routes/invite'
},
{
plugin: './server/web/routes/login'
},
{
plugin: './server/web/routes/public'
},
{
plugin: './server/web/routes/sessions'
},
{
plugin: './server/web/routes/setup'
},
{
plugin: './server/web/routes/signup'
},
{
plugin: './server/web/routes/tokens'
},
{
plugin: './server/web/routes/users'
}
]
]
}
};


Expand Down

0 comments on commit fa766f6

Please sign in to comment.