// Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements.
// Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements.
requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up`
// requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up`
program
program
.version('0.1.2')
.version('0.1.2');
program
program
.command('static <domain> [outPort]')
.command('static <domain> [outPort]')
.description('Create a static server at this folder.')
.description('Create a static server at this folder.')
.action(function(domain,outPort=80){//If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings.
.action(function(domain,outPort=80){//If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings.
if(!validate(domain,outPort))return//Validates domain and outport, and if invalid, throws and returns.
if(!validate(domain,outPort))return;//Validates domain and outport, and if invalid, throws and returns.
createStaticServer(domain,outPort)
createStaticServer(domain,outPort);
console.log("Done! Your static server has been set up!\nPoint your domain to this server and check "+chalk.cyan(domain)+" to verify!")
console.log("Done! Your static server has been set up!\nPoint your domain to this server and check "+chalk.cyan(domain)+" to verify!");
})
});
program
program
.command('proxy <domain> <inPort> [outPort]')
.command('proxy <domain> <inPort> [outPort]')
.description('Create a proxy server, listening at port number.')
.description('Create a proxy server, listening at port number.')
.action(function(domain,inPort,outPort="80"){//Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings.
.action(function(domain,inPort,outPort="80"){//Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings.
if(!validate(domain,inPort,outPort))return
if(!validate(domain,inPort,outPort))return;
createProxyServer(domain,inPort,outPort)
createProxyServer(domain,inPort,outPort);
console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check "+chalk.cyan(domain)+" to verify!")
console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check "+chalk.cyan(domain)+" to verify!");
})
});
program
program
.command('list')
.command('list')
.description('List all available servers.')
.description('List all available servers.')
.action(function(){
.action(function(){
// Stuff happens here
// Stuff happens here
})
});
program
program
.command('kill <domain>')
.command('kill <domain>')
.description('Kill a server.')
.description('Kill a server.')
.action(function(domain){
.action(function(domain){
// Stuff happens here
killServer(domain);
})
console.log("Done! Your server has been killed!\n");
});
program
program
.command('*')// This should pick invalid commands, but it doesn't, yet.
.command('*')// This should pick invalid commands, but it doesn't, yet.
.action(function(){
.action(function(){
console.log("Invalid command. Type "+chalk.cyan('up --help')+" for help.")
console.log("Invalid command. Type "+chalk.cyan('up --help')+" for help.")
})
});
// Adds custom help text to the automatically generated help.
// Adds custom help text to the automatically generated help.