Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
Add CLI and pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Maigret Aurélien committed May 9, 2020
1 parent 3ba5f7a commit 9dc5c41
Show file tree
Hide file tree
Showing 5 changed files with 1,203 additions and 152 deletions.
41 changes: 41 additions & 0 deletions cli/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { program } = require('commander')
const pkg = require('../package.json')
const proxyToGce = require('../proxy-to-gce')
const server = require('../server')

program
.version(pkg.version)
.name('gce')

program
.command('server <configDirectories...>')
.description('Run GCE server')
.option('-s, --ssl <gceHost>', 'enable SSL, and set GCE host/domain', null)
.option('-g, --gce-server-port <port>', 'GCE server port', /^[0-9]+$/, 6730)
.option('-l, --gce-lb-port <port>', 'GCE Load-Balancer port', /^[0-9]+$/, 6731)
.action(function (configDirectories, cmd) {
server({
serverPort: +cmd.gceServerPort,
loadBalancerPort: +cmd.gceLbPort,
ssl: cmd.ssl,
configDirectories
})
})

program
.command('proxy-to-gce')
.description('Create a proxy to GCE on port 443')
.option('-l, --gce-lb-port <port>', 'GCE Load-Balancer port', /^[0-9]+$/, 6731)
.option('-m, --manager-port <port>', 'proxy manager port', /^[0-9]+$/, 6732)
.option('-p, --proxy-port <port>', 'proxy port', /^[0-9]+$/, 443)
.option('-s, --manager-stop-path <path>', 'manager path to stop proxy', 'stop-proxy-to-gce')
.action(function (cmd) {
proxyToGce({
gceSecurePort: +cmd.gceLbPort,
managerPort: +cmd.managerPort,
proxyPort: +cmd.proxyPort,
managerStopPath: cmd.managerStopPath
})
})

program.parse()
17 changes: 0 additions & 17 deletions index.js

This file was deleted.

Loading

0 comments on commit 9dc5c41

Please sign in to comment.