Skip to content
Permalink
Browse files

[DDW 727] Update frontendOnly script to discover ngrok host

  • Loading branch information...
Sam-Jeston committed Jul 12, 2019
1 parent d06d295 commit 566d8326b9d21f7d603abcc11149f17073fc81c3
Showing with 25 additions and 11 deletions.
  1. +24 −10 frontend-only-launcher/index.js
  2. +1 −1 source/renderer/app/api/utils/request.js
@@ -1,6 +1,7 @@
const fs = require('fs')
const rimraf = require('./lib/rimraf')
const createAndWriteX509 = require('./lib/x509')
const { exec } = require('child_process')

// Declare our state directory for logging and tls certs
const stateDir = `${process.cwd()}/frontend-only-launcher/state`
@@ -25,13 +26,26 @@ createAndWriteX509(`${stateDir}/tls/client`)
// Specific env vars
const cardanoTlsPath = `${stateDir}/tls`

console.log(`
Start command:
CARDANO_TLS_PATH=${cardanoTlsPath} \\
CARDANO_HOST=localhost \\
CARDANO_PORT=8088 \\
LAUNCHER_CONFIG=${process.cwd()}/frontend-only-launcher/launcher-config-base.yaml \\
STATE_DIR=${stateDir} \\
yarn dev
`)
// Determine ngrok proxy
exec('docker exec cardano-byron-docker_proxy_1 curl -s localhost:4040/api/tunnels', (err, stdout) => {
if (err) {
throw err
}

const data = JSON.parse(stdout)
const url = data.tunnels.find(el => el.proto === 'http').public_url
.split('http://')[1]

console.log(`
Start command:
CARDANO_TLS_PATH=${cardanoTlsPath} \\
CARDANO_HOST=${url} \\
CARDANO_PORT=80 \\
LAUNCHER_CONFIG=${process.cwd()}/frontend-only-launcher/launcher-config-base.yaml \\
STATE_DIR=${stateDir} \\
yarn dev
`)

process.exit()
})
@@ -66,7 +66,7 @@ function typedRequest<Response>(
}

// TODO: Delete once HTTPS is supported by the new API
const httpOnlyOptions = {
let httpOnlyOptions = {
hostname: options.hostname,
method: options.method,
path: options.path,

0 comments on commit 566d832

Please sign in to comment.
You can’t perform that action at this time.