Skip to content

Commit

Permalink
chore(xo-server-test): add app-conf
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-m-dev committed Oct 31, 2024
1 parent 34bccbd commit 67e18cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/xo-server-test/connect.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import appConf from 'app-conf'
import Xo from 'xo-lib'
const XoConnection = Xo.default

const SERVER_URL = process.env.SERVER_URL || 'http://127.0.0.1:80'
const xoServerHttpConfig = (
await appConf.load('xo-server', {
appDir: new URL('..', import.meta.url).pathname,
ignoreUnknownFormats: true,
})
).http.listen[0]
const port = xoServerHttpConfig.port || 80
const hostname = xoServerHttpConfig.hostname || 'localhost'
const SERVER_URL = `http://${hostname}:${port}`

/**
* @param params Contains {url, email, password} as the optionnal server url, and the email/password of the user
Expand Down
3 changes: 2 additions & 1 deletion packages/xo-server-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
},
"scripts": {
"watch": "node --test --watch",
"start": "node --test"
"start": "node --test",
"test": "node --test"
},
"jest": {
"modulePathIgnorePatterns": [
Expand Down

0 comments on commit 67e18cb

Please sign in to comment.