var okcms = require('okcms') var path = require('path') var isProduction = process.env.OK_PRODUCTION === 'true' var app = okcms.createApp({ project: 'Hansel and Gretel', debug: !isProduction, production: isProduction, admin: { dashboard: { resources: { painting: { display: 'image', } } } }, schemas: { timeline: { id: {type: 'string', hidden: true}, date: {type: 'string'}, title: {type: 'string'}, medium: {type: 'string'}, category: {type: 'enum', options:['Surveillance','Drones','Facial Recognition']}, keywords: {type: 'text'}, description: {type: 'text'}, image: {type: 'image'}, credit: {type: 'text'}, links: {type: 'link-list'}, disabled: {type: 'flag'}, }, drone: { id: {type: 'string', hidden: true}, title: {type: 'string'}, intro: {type: 'text'}, strikes: {type: 'string'}, totalKilled: {type: 'string'}, civiliansKilled: {type: 'string'}, childrenKilled: {type: 'string'}, statisticsByline: {type: 'text'}, moreInfo: {type: 'text'}, links: {type: 'link-list'}, }, about: { id: {type: 'string', hidden: true}, title: {type: 'string'}, show: {type: 'text'}, herzogBio: {type: 'text'}, deMeuronBio: {type: 'text'}, aiWeiWeiBio: {type: 'text'}, video: {type: 'video'}, }, page: { id: {type: 'string', hidden: true}, title: {type: 'string'}, body: {type: 'text'}, disabled: {type: 'flag'}, }, essay: { id: {type: 'string', hidden: true}, title: {type: 'string'}, byline: {type: 'string'}, body: {type: 'text'}, disabled: {type: 'flag'}, }, stream: { id: {type: 'string', hidden: true}, title: {type: 'string'}, body: {type: 'text'}, streams: {type: 'link-list'}, disabled: {type: 'flag'}, }, }, resources: [ { type: 'timeline' }, { type: 'page' }, { type: 'essay' }, { type: 'stream' }, { type: 'drone' }, { type: 'about' }, ], views: { '/': { template: 'blank' }, '/home/': { template: 'index' }, '/information/': { template: 'index' }, '/drones/': { template: 'index' }, '/livestream/': { template: 'index' }, '/contact/': { template: 'index' }, '/timeline/': { template: 'index' }, '/timeline/:id': { template: 'index' }, '/page/:id': { template: 'index' }, '/photo/:id': { template: 'photo' }, }, services: { s3: { key: process.env.S3_KEY, secret: process.env.S3_SECRET, bucket: process.env.S3_BUCKET, dirname: process.env.S3_DIRNAME, maxbytes: 1024*1024*2, }, awmail: { lib: require("./lib/awmail"), apikey: process.env.MAILGUN_API_KEY, domain: process.env.MAILGUN_DOMAIN, secret: process.env.MAIL_SECRET, from: 'Hansel and Gretel ', subject: 'We Found Your Face', }, awfeedback: { lib: require("./lib/awfeedback"), spreadsheet: '12fUN-pUlTpdly88pGVFlHuHDmAP8YCpVfn9IxIVf5Vs', credentials: path.join(__dirname, "./lib/awfeedback/tokens/client_secret.json"), token: path.join(__dirname, "./lib/awfeedback/tokens/client_token.json"), }, awprint: { lib: require("./lib/awprint"), mongodbUrl: "mongodb://localhost/awprint", }, awdrone: { lib: require("./lib/awdrone"), }, push: { lib: require("./lib/okpush"), mongodbUrl: "mongodb://localhost/okpush_hga", production: false, apn_development: { cert: path.join(__dirname, "./lib/okpush/certs/aps_development_cert.pem"), key: path.join(__dirname, "./lib/okpush/certs/aps_development_key.pem"), connection: { gateway: "gateway.sandbox.push.apple.com", } }, apn_production: { cert: path.join(__dirname, "./lib/okpush/certs/aps_production_cert.pem"), key: path.join(__dirname, "./lib/okpush/certs/aps_production_key.pem"), connection: { gateway: "gateway.push.apple.com", } }, bundleId: "studio.undisclosed.hanselandgretel", notifications: { // expiry (in seconds) // badge (int) // alert (message) // payload (raw json) feed: { expiry: 1, alert: "Database updated.", }, } }, }, }).listen(process.env.PORT || 1337) console.log('Server listening at port ' + (process.env.PORT || 1337) + '...');