Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix [bug951709] - Changed env vars HOSTNAME to APP_HOSTNAME
Browse files Browse the repository at this point in the history
  • Loading branch information
admix committed Mar 27, 2014
1 parent 9d8d203 commit 3b62d0a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -69,7 +69,7 @@ The default server configuration can be found in [lib/default-config.js](lib/def
#### Configuration Options

- `PORT` the port to bind the server to
- `hostname` the hostname for the server (e.g., `http://localhost:8888`, `https://popcorn.webmaker.org`). **This must match your browser's address bar otherwise Persona login will not work**
- `APP_HOSTNAME` the hostname for the server (e.g., `http://localhost:8888`, `https://popcorn.webmaker.org`). **This must match your browser's address bar otherwise Persona login will not work**
- `logger` settings for server logging
- `format` the logging format to use. Possible values include: default, short, tiny, dev.
- `session` settings for user sessions
Expand All @@ -79,7 +79,7 @@ The default server configuration can be found in [lib/default-config.js](lib/def
- `dirs` settings for various directories, paths, hostnames
- `wwwRoot` the server's WWW root directory (e.g., `../`)
- `templates` the location of templates (e.g., `../templates`)
- `embedHostname` *[optional]* the hostname URL where published embed documents are stored, if different from `hostname` (e.g., `http://s3.amazonaws.com/your-bucket`)
- `embedHostname` *[optional]* the hostname URL where published embed documents are stored, if different from `APP_HOSTNAME` (e.g., `http://s3.amazonaws.com/your-bucket`)
- `templates` list of templates to serve. The format is as follows:
`<template-name>`: `{{templateBase}}<path/to/template/config.json>`. The `{{templateBase}}` string will be replaced by the value in `dirs.templates` (e.g., "basic": "{{templateBase}}basic/config.json")

Expand Down Expand Up @@ -120,7 +120,7 @@ The `fileStore` type is used to setup a backend for storing data:

- `type` the type of file store to use. Possible values include `local` (i.e., local file system) and `s3` (i.e., Amazon S3)
- `options` options for the file store, which depends on the type chosen.
- `hostname` the hostname to use for constructing urls if different than `embedHostname`
- `APP_HOSTNAME` the hostname to use for constructing urls if different than `embedHostname`
- local options
- `root` the root directory under which all exported files are placed (e.g., `./view`)
- `namePrefix` *[optional]* the path prefix to add to any filenames passed to the local file store. For example, if using "v" all filenames will become "v/<key>"
Expand Down
4 changes: 2 additions & 2 deletions lib/config.js
Expand Up @@ -25,7 +25,7 @@ nconf.defaults( require( "./default-config.js" ) );
},
{
old: "dirs:appHostname",
new: "hostname"
new: "APP_HOSTNAME"
}
].forEach(function( pref ) {
if ( nconf.get( pref.old ) ) {
Expand All @@ -39,7 +39,7 @@ nconf.defaults( require( "./default-config.js" ) );
});

// Validate hostname by parsing using url module.
var hostName = require( "url" ).parse( nconf.get( "hostname" ) );
var hostName = require( "url" ).parse( nconf.get( "APP_HOSTNAME" ) );

// We must check protocol explicitly for http or https, because the url module is easy to fool
if ( !hostName.protocol || !hostName.hostname || !/^https?:$/.test( hostName.protocol ) ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/default-config.js
Expand Up @@ -6,7 +6,7 @@ module.exports = {
// hostname must match the address in your browser's URL bar
// If it does not, then Persona sign-in will not work
// Don't add any trailing slashes, just protocol://hostname[:port]
"hostname": "http://localhost:8888",
"APP_HOSTNAME": "http://localhost:8888",

"OPTIMIZE_JS": false,
"OPTIMIZE_CSS": false,
Expand Down
2 changes: 1 addition & 1 deletion server.js
Expand Up @@ -25,7 +25,7 @@ var express = require( "express" ),
Project,
filter,
middleware,
APP_HOSTNAME = config.hostname,
APP_HOSTNAME = config.APP_HOSTNAME,
WWW_ROOT = __dirname + "/public",
i18n = require( "webmaker-i18n" ),
WebmakerAuth = require( "webmaker-auth" ),
Expand Down

0 comments on commit 3b62d0a

Please sign in to comment.