Skip to content

Enable proxy using for http requests #310

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"DEBUG": false,
"USE_PROXY": false,
"PROXY_PORT": 8888,
"PROXY_HOSTNAME": "127.0.0.1",
"TYPESCRIPT_COMPILER_OPTIONS": {},
"CI_LOGGER": false
}
2 changes: 1 addition & 1 deletion lib/common
19 changes: 14 additions & 5 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
import path = require("path");
import util = require("util");
import staticConfigBaseLibPath = require("./common/static-config-base");
import configBaseLib = require("./common/config-base");

$injector.register("config", {
CI_LOGGER: false,
DEBUG: process.env.NATIVESCRIPT_DEBUG,
TYPESCRIPT_COMPILER_OPTIONS: { }
});
export class Configuration extends configBaseLib.ConfigBase { // User specific config
CI_LOGGER = false;
DEBUG = process.env.NATIVESCRIPT_DEBUG;
TYPESCRIPT_COMPILER_OPTIONS = {};
USE_PROXY = false;

/*don't require logger and everything that has logger as dependency in config.js due to cyclic dependency*/
constructor(protected $fs: IFileSystem) {
super($fs);
_.extend(this, this.loadConfig("config").wait());
}
}
$injector.register("config", Configuration);

export class StaticConfig extends staticConfigBaseLibPath.StaticConfigBase implements IStaticConfig {
public PROJECT_FILE_NAME = ".tnsproject";
Expand Down
9 changes: 5 additions & 4 deletions lib/nativescript-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import Future = require("fibers/future");
import errors = require("./common/errors");
errors.installUncaughtExceptionListener();

var config = <Config.IConfig>$injector.resolve("$config");
(<IErrors>$injector.resolve("$errors")).printCallStack = config.DEBUG;

fiber(() => {
var commandDispatcher : ICommandDispatcher = $injector.resolve("commandDispatcher");
var config = <Config.IConfig>$injector.resolve("$config");
var err = <IErrors>$injector.resolve("$errors");
err.printCallStack = config.DEBUG;

var commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher");

if (process.argv[2] === "completion") {
commandDispatcher.completeCommand().wait();
Expand Down