Skip to content

Commit

Permalink
fix: Use baseUrl in CLI server
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Oct 20, 2020
1 parent 304eaba commit 7b18ac6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 148 deletions.
143 changes: 0 additions & 143 deletions agent-alice.yml

This file was deleted.

2 changes: 1 addition & 1 deletion packages/daf-cli/default/default.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
hostname: localhost
baseUrl: http://localhost:3332
port: 3332
schemaPath: /open-api.json
apiBasePath: /agent
Expand Down
6 changes: 2 additions & 4 deletions packages/daf-cli/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ program
console.log('🧩 Available methods', agent.availableMethods().length)
console.log('🛠 Exposed methods', exposedMethods.length)

let hostname = options.hostname

let baseUrl = 'http://' + hostname + ':' + options.port
let baseUrl = options.baseUrl

if (options.ngrok?.connect) {
baseUrl = await ngrok.connect({
Expand All @@ -44,8 +42,8 @@ program
region: options.ngrok.region,
authtoken: options.ngrok.authtoken,
})
hostname = parse(baseUrl).hostname
}
const hostname = parse(baseUrl).hostname

const openApiSchema = getOpenApiSchema(agent, apiBasePath, exposedMethods)
openApiSchema.servers = [{ url: baseUrl }]
Expand Down

0 comments on commit 7b18ac6

Please sign in to comment.