-
Notifications
You must be signed in to change notification settings - Fork 3
Server config
jsguy edited this page Dec 31, 2015
·
4 revisions
You can configure many aspects of miso in the server config. The server config is in the /cfg directory, and you can create configurations for different environments, as set by NODE_ENV, the conventions are:
- production: /cfg/server.json - every other config inherits from this
- development: /cfg/server.development.json
To create another environment, simply create /cfg/server.ENVIRONMENTNAME.json, where ENVIRONMENTNAME is whatever you set NODE_ENV to - you also need to setup a command in package.json in the "scripts" object, named the same as your environment. By default we assume the environment to be "development", if NODE_ENV is not set.
- port - what port the express server should run on - default is 3001 for production
- session:secret - a session signing secret, default is "session-cookie-signing-secret", you should set your own unique key here, and it is advisable to create new keys regularly
- authentication:enabled - if you want to use the built in authentication, default is false
- authentication:all - if all routes are to be authenticated, default is false, you can set each route to be authenticated or excluded individually
- authentication:secret - secret key to identify that a session is authenticated
- authentication:loginUrlPattern - URL to redirect to for login, optionally use a pattern for redirect URL, default is "/login?url=[ORIGINALURL]"
- authentication:middleware - what middleware to use for authenticating - default is "../system/auth_middle", be sure to follow the same pattern
- routeMiddleware - optional middleware for routing, default is "../system/default_middle", this can be a list of routes used in a "filter" like fashion
- layout - what layout to use, default is "../mvc/layout_miso.js", this affects login, authentication, etc, so be sure to replicate what you need.
- layoutComponents - a list of components to include with the layout - useful for adding navigation and other dynamic components to the default layout
- apiPath - what path to use for api requests, default is "/api"
- apiClientPath - an optional prefix to the API URL requests - default is "", you can use this to point to a specific server for API requests, this is useful for cordova apps or other distributed systems that need to point to non-local APIs
- cordova - if we want to user cordova features, this includes waiting for the deviceready event, which adds a minimum 1 second delay, so only use this when compiling for cordova use, default is false
- staticPath - an optional parameter to set an extra path to static resources, this is useful for creating cordova apps, and linking to resources, such as images included in the app
- api - a list of APIs to compile, you must include each API you want to use here
- minify - if we minify the generated JS source, default is true, disable this for development
- sourceMap - if we create a source map for the generated JS, default is true
- pretty - if we make the HTML look pretty, default is false, it is more efficient to have compact HTML
- reload - if we use the automatic reloading feature, default is false, this is only to be used in development mode, as it creates a websocket for each connected user