Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config tests #552

Merged
merged 2 commits into from
Jul 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/boilerplates/config/views.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
module.exports.views = {

// Engine for views (can be ejs, haml, etc.)
engine: 'ejs',
Expand Down
77 changes: 77 additions & 0 deletions test/config/integration/fixtures/config/adapters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Configure installed adapters
// If you define an attribute in your model definition,
// it will override anything from this global config.
module.exports.adapters = {

// TEST CONFIGS //
'default': 'custom',

custom: {
module: 'sails-disk'
},

sqlite: {
module: 'sails-sqlite',
host: 'sqliteHOST',
user: 'sqliteUSER'
},

// TESTS END //

memory: {
module: 'sails-memory'
},
disk: {
module: 'sails-disk'
},
mongo: {
module: 'sails-mongo',
host: 'localhost',
user: 'root'
},
redis: {
module: 'sails-redis',
host: 'localhost',
user: 'root'
},
riak: {
module: 'sails-riak',
host: 'localhost',
user: 'root'
},
cassandra: {
module: 'sails-cassandra',
host: 'localhost',
user: 'root'
},
elasticsearch: {
module: 'sails-elasticsearch',
host: 'localhost',
user: 'root'
},
couchbase: {
module: 'sails-couchbase',
host: 'localhost',
user: 'root'
},
mysql: {
module: 'sails-mysql',
host: 'localhost',
user: 'root'
},
postgresql: {
module: 'sails-postgresql',
host: 'localhost',
user: 'root'
},
oracle: {
module: 'sails-oracle',
host: 'localhost',
user: 'root'
},
db2: {
module: 'sails-db2',
host: 'localhost',
user: 'root'
}
};
46 changes: 46 additions & 0 deletions test/config/integration/fixtures/config/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
// all configs (not commented out) will be tested

// Port to run this app on
port: 1702,

// Self-awareness: the host the server *thinks it is*
host: 'GLaDOS',

// Name of application for layout title
appName: 'portal',

// Environment to run this app in; one of: ["development", "production"]
environment: 'production',

// HTTP cache configuration
cache: {
maxAge: 9001
},

// Custom options for express server
/*express: {

// Sails extras
serverOptions: null,
customMiddleware: null,

// Built-in
bodyParser: require('express').bodyParser,
cookieParser: require('express').cookieParser,
methodOverride: require('express').methodOverride
},*/

// Variables which will be made globally accessible
globals: {
_: false,
/*async: false,
sails: true,
services: false,
adapters: false,
models: false*/
},

//ssl: {}

};
7 changes: 7 additions & 0 deletions test/config/integration/fixtures/config/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// App bootstrap
// Code to run before launching the app
//
// Make sure you call cb() when you're finished.
module.exports.bootstrap = function (cb) {
cb();
};
31 changes: 31 additions & 0 deletions test/config/integration/fixtures/config/controllers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports.controllers = {
// all configs not commented out will be tested

// (Note: global controller.routes config may be overridden on a per-controller basis
// by setting the 'blueprint' property in a controller)
routes: {

// Whether routes are automatically generated for controller actions
actions: false,

// e.g. '/:controller/find/:id'
//shortcuts: true,

// e.g. 'get /:controller/:id?': 'foo.find'
//rest: true,

// Optional mount path prefix for blueprint routes
// e.g. '/api/v2'
prefix: 'Z',

// If a blueprint REST route catches a request,
// only match an `id` if it's an integer
expectIntegerId: true
},


// CSRF middleware protection, all non-GET requests must send '_csrf' parmeter
// _csrf is a parameter for views, and is also available via GET at /csrfToken
csrf: true

};
134 changes: 134 additions & 0 deletions test/config/integration/fixtures/config/io.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// Configuration for internal socket.io server
module.exports.io = {
// all uncommented configs will be tested

// Setup adapter to use for socket.io MQ (pubsub) store
// (`undefined` indicates default memory store)
// NOTE: Default memory store will not work for clustered deployments with multiple instances.
adapter: 'disk',

// A array of allowed transport methods which the clients will try to use.
// The flashsocket transport is disabled by default
// You can enable flashsockets by adding 'flashsocket' to this list:
transports: [
'websocket'
//'htmlfile',
//'xhr-polling',
//'jsonp-polling'
],

// Match string representing the origins that are allowed to connect to the Socket.IO server
origins: '*:1337',

// Should we use heartbeats to check the health of Socket.IO connections?
heartbeats: false,

// When client closes connection, the # of seconds to wait before attempting a reconnect.
// This value is sent to the client after a successful handshake.
'close timeout': 10,

// The # of seconds between heartbeats sent from the client to the server
// This value is sent to the client after a successful handshake.
//'heartbeat timeout': 60,

// The max # of seconds to wait for an expcted heartbeat before declaring the pipe broken
// This number should be less than the `heartbeat timeout`
//'heartbeat interval': 25,

// The maximum duration of one HTTP poll-
// if it exceeds this limit it will be closed.
//'polling duration': 20,

// Enable the flash policy server if the flashsocket transport is enabled
//'flash policy server': false,

// By default the Socket.IO client will check port 10843 on your server
// to see if flashsocket connections are allowed.
// The Adobe Flash Player normally uses 843 as default port,
// but Socket.io defaults to a non root port (10843) by default
//
// If you are using a hosting provider that doesn't allow you to start servers
// other than on port 80 or the provided port, and you still want to support flashsockets
// you can set the `flash policy port` to -1
//'flash policy port': 10843,

// Used by the HTTP transports. The Socket.IO server buffers HTTP request bodies up to this limit.
// This limit is not applied to websocket or flashsockets.
//'destroy buffer size': '10E7',

// Do we need to destroy non-socket.io upgrade requests?
//'destroy upgrade': true,

// Does Socket.IO need to serve the static resources like socket.io.js and WebSocketMain.swf etc.
//'browser client': true,

// Cache the Socket.IO file generation in the memory of the process
// to speed up the serving of the static files.
//'browser client cache': true,

// Does Socket.IO need to send a minified build of the static client script?
//'browser client minification': false,

// Does Socket.IO need to send an ETag header for the static requests?
//'browser client etag': false,

// Adds a Cache-Control: private, x-gzip-ok="", max-age=31536000 header to static requests,
// but only if the file is requested with a version number like /socket.io/socket.io.v0.9.9.js.
//'browser client expires': 315360000,

// Does Socket.IO need to GZIP the static files?
// This process is only done once and the computed output is stored in memory.
// So we don't have to spawn a gzip process for each request.
//'browser client gzip': false,

// A function that should serve all static handling, including socket.io.js et al.
//'browser client handler': false,

// Meant to be used when running socket.io behind a proxy.
// Should be set to true when you want the location handshake to match the protocol of the origin.
// This fixes issues with terminating the SSL in front of Node
// and forcing location to think it's wss instead of ws.
//'match origin protocol': false,

// Global authorization for Socket.IO access,
// this is called when the initial handshake is performed with the server.
//
// By default, Sails verifies that a valid cookie was sent with the upgrade request
// However, in the case of cross-domain requests, no cookies are sent for some transports,
// so sockets will fail to connect. You might also just want to allow anyone to connect w/o a cookie!
//
// To bypass this cookie check, you can set `authorization: false`,
// which will silently create an anonymous cookie+session for the user
//
// `authorization: true` indicates that Sails should use the built-in logic
//
// You can also use your own custom logic with:
// `authorization: function (data, accept) { ... }`
authorization: false,

// Direct access to the socket.io MQ store config
// The 'adapter' property is the preferred method
// (`undefined` indicates that Sails should defer to the 'adapter' config)
//store: undefined,

// A logger instance that is used to output log information.
// (`undefined` indicates deferment to the main Sails log config)
//logger: undefined,

// The amount of detail that the server should output to the logger.
// (`undefined` indicates deferment to the main Sails log config)
'log level': 'error',

// Whether to color the log type when output to the logger.
// (`undefined` indicates deferment to the main Sails log config)
'log colors': true,

// A Static instance that is used to serve the socket.io client and its dependencies.
// (`undefined` indicates use default)
'static': false,

// The entry point where Socket.IO starts looking for incoming connections.
// This should be the same between the client and the server.
resource: '/all/the/sockets'

};
17 changes: 17 additions & 0 deletions test/config/integration/fixtures/config/local.ex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Local configuration
//
// Included in the .gitignore by default,
// this is where you include configuration overrides for your local system
// or for a production deployment.


// For example, to use port 80 on the local machine, override the `port` config
// module.exports.port = 80;

// or to keep your db credentials out of the repo, but to use them on the local machine
// override the `modelDefaults` config
// module.exports.modelDefaults = { database: 'foo', user: 'bar', password: 'baZ'}

module.exports = {
appName: 'portal3',
}
17 changes: 17 additions & 0 deletions test/config/integration/fixtures/config/local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Local configuration
//
// Included in the .gitignore by default,
// this is where you include configuration overrides for your local system
// or for a production deployment.


// For example, to use port 80 on the local machine, override the `port` config
// module.exports.port = 80;

// or to keep your db credentials out of the repo, but to use them on the local machine
// override the `modelDefaults` config
// module.exports.modelDefaults = { database: 'foo', user: 'bar', password: 'baZ'}

module.exports = {
appName: 'portal2',
}
8 changes: 8 additions & 0 deletions test/config/integration/fixtures/config/locales/english.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* English string set
*
*/
var english = {
'hello world': 'konichiwa'
};
module.exports = english;
16 changes: 16 additions & 0 deletions test/config/integration/fixtures/config/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {

// Logger
// Valid `level` configs:
//
// - error
// - warn
// - debug
// - info
// - verbose
//
log: {
level: 'error'
}

};
21 changes: 21 additions & 0 deletions test/config/integration/fixtures/config/policies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Policy defines middleware that is run before each controller/controller.
* Any policy dropped into the /middleware directory is made globally available through sails.middleware
* Below, use the string name of the middleware
*/
module.exports.policies = {

// Default policy (allow public access)
'*': false

/** Example mapping:
someController: {

// Apply the "authenticated" policy to all actions
'*': 'authenticated',

// For someAction, apply 'somePolicy' instead
someAction: 'somePolicy'
}
*/
};
Loading