Skip to content

Commit

Permalink
feat: enable CORS in daf-cli server by default (#284)
Browse files Browse the repository at this point in the history
This lets any web client execute cloud agent methods.
  • Loading branch information
simonas-notcat committed Dec 1, 2020
1 parent e8bae3f commit aca46b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/daf-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"blessed": "^0.1.81",
"commander": "^6.1.0",
"console-table-printer": "^2.0.0",
"cors": "^2.8.5",
"cross-fetch": "^3.0.6",
"daf-core": "^7.0.0-beta.51",
"daf-did-comm": "^7.0.0-beta.51",
Expand Down
2 changes: 2 additions & 0 deletions packages/daf-cli/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from 'express'
import cors from 'cors'
import program from 'commander'
import ngrok from 'ngrok'
import parse from 'url-parse'
Expand All @@ -24,6 +25,7 @@ program
.option('-p, --port <number>', 'Optionally set port to override config')
.action(async (cmd) => {
const app = express()
app.use(cors())
const agent = getAgent(program.config)
const { server: options } = createObjects(getConfig(program.config), { server: '/server' })

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5411,7 +5411,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=

cors@2.8.5, cors@^2.8.1:
cors@2.8.5, cors@^2.8.1, cors@^2.8.5:
version "2.8.5"
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
Expand Down

0 comments on commit aca46b3

Please sign in to comment.