// Copyright 2017, University of Colorado Boulder

/**
 * Settings defined in buildLocal
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
/* eslint-env node */
'use strict';

// modules
const assert = require( 'assert' );
const fs = require( 'fs' );
const winston = require( 'winston' );

// Handle the lack of build.json
var buildLocalObject;
try {
  buildLocalObject = JSON.parse( fs.readFileSync( process.env.HOME + '/.phet/build-local.json', 'utf8' ) );
} 
catch ( e ) {
  winston.warn( 'No build-local.json detected!' );
  buildLocalObject = {};
}

module.exports = {
  get devUsername() {
    assert( buildLocalObject.devUsername );
    return buildLocalObject.devUsername;
  },
  get buildServerAuthorizationCode() {
    assert( buildLocalObject.buildServerAuthorizationCode );
    return buildLocalObject.buildServerAuthorizationCode;
  },
  get localhostURL() {
    assert( buildLocalObject.localhostURL );
    return buildLocalObject.localhostURL;
  },
  get localhostPort() {
    return buildLocalObject.localhostPort;
  },
  // Wrappers are now deployed to the dev location (for convenience)
  devDeployServer: buildLocalObject.devDeployServer || 'bayes.colorado.edu',
  devDeployPath: buildLocalObject.devDeployPath || '/data/web/htdocs/dev/html/',
  buildServerNotifyEmail: buildLocalObject.buildServerNotifyEmail || null,
  productionServerURL: buildLocalObject.productionServerURL || 'https://phet.colorado.edu'
};

@@ -974,80 +974,8 @@
  %7D,%0A
-  get localhostPort() %7B%0A    return buildLocalObject.localhostPort;%0A  %7D,%0A
   //

remove localhostPort key, see https://github.com/phetsims/binder/issues/13