Skip to content

Commit 750f123

Browse files
committed
the app knows of localhost as a config
1 parent 7a1e89c commit 750f123

7 files changed

Lines changed: 17 additions & 15 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v6
1717
- name: Build the Docker image
18-
run: "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" }};' > config/local.js && docker build . --file Dockerfile --tag fielddb-auth:$(date +%s)"
18+
run: "echo 'module.exports = { usersDbConnection: { url: \"http://couchdb:5984\" }};' > config/localhost.js && docker build . --file Dockerfile --tag fielddb-auth:$(date +%s)"

.github/workflows/node.js.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [24.x]
17+
node-version: [25.x]
1818
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
1919

2020
steps:
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Create local config for the app to connect to couchdb service in the container
3131
run: |
32-
echo 'module.exports = { usersDbConnection: { url: "http://couchdb:5984" }};' > config/local.js
32+
echo 'module.exports = { usersDbConnection: { url: "http://couchdb:5984" }};' > config/localhost.js
3333
3434
- name: Start docker compose services
3535
run: docker compose up -d && sleep 5
@@ -44,14 +44,14 @@ jobs:
4444
DEBUG: 'none'
4545

4646
- name: Run E2E tests against the container app
47-
run: npm run test:deprecated:e2e || echo 'Test run failed when trying to use the deployed auth app'
47+
run: DEBUG=test:deprecated npm run test:deprecated:e2e || echo 'Test run failed when trying to use the deployed auth app'
4848
env:
4949
SOURCE_URL: ${{ secrets.SOURCE_URL }}
5050
DEBUG: 'none'
5151

5252
- name: Show docker compose logs
5353
if: success() || failure()
54-
run: docker compose logs --no-color --timestamps || true
54+
run: docker compose logs --no-color --timestamps | grep -v "couchdb" || true
5555

5656
integration-tests:
5757
runs-on: ubuntu-latest
@@ -66,14 +66,14 @@ jobs:
6666
- run: npm ci
6767
- name: Create local config for tests to use the couchdb from the container
6868
run: |
69-
echo 'module.exports = { usersDbConnection: { url: "http://localhost:5984" }};' > config/local.js
69+
echo 'module.exports = { usersDbConnection: { url: "http://localhost:5984" }};' > config/localhost.js
7070
- name: Run Integration tests
7171
run: DEBUG=replay* npm run coverage || echo 'Test run failed replay no longer is working with latest nano which uses node fetch'
7272
- name: Run integration tests using the app with local couchdb
7373
run: npm run test:deprecated:coverage
7474
env:
7575
SOURCE_URL: ${{ secrets.SOURCE_URL }}
76-
DEBUG: 'none'
76+
DEBUG: 'lib:corpus'
7777
- name: Upload coverage report
7878
uses: actions/upload-artifact@v5
7979
if: success() || failure()
@@ -95,10 +95,10 @@ jobs:
9595
with:
9696
sparse-checkout: |
9797
package.json
98-
- name: Use Node.js 24.x
98+
- name: Use Node.js 25.x
9999
uses: actions/setup-node@v6
100100
with:
101-
node-version: 24.x
101+
node-version: 25.x
102102
cache: 'npm'
103103
- name: Run UI tests
104104
run: npm run test:ui

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ compiled_handlebars.js
77
*_production*
88
config/production.*
99
config/local.*
10+
config/localhost.*
1011
etc
1112
Dockerfile-couchdb
1213
db

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ COPY . .
77
RUN NODE_ENV=production npm ci
88

99
RUN ls -alt; \
10-
ls config/local.js || echo " config/local.js is required to be able to run the tests against deployed couchdb"
10+
ls config/localhost.js || echo " config/localhost.js is required to be able to run the tests against deployed couchdb"
1111

1212
ENV DEBUG="*,-express*"
13-
ENV NODE_ENV=local
13+
ENV NODE_ENV=localhost
1414

1515
EXPOSE 3183
1616

auth_service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const bunyan = require('express-bunyan-logger');
88
* $ NODE_ENV=production # uses config/production.js
99
* $ NODE_ENV=test # uses config/test.js
1010
* $ NODE_ENV=development # uses config/development.js
11-
* $ NODE_ENV=local # uses config/local.js
11+
* $ NODE_ENV=localhost # uses config/localhost.js
1212
* $ NODE_ENV=yoursecretconfig # uses config/yoursecretconfig.js
1313
*/
1414
const config = require('config');

config/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path');
33
const { Connection } = require('fielddb/api/corpus/Connection');
44

55
let deployTarget = process.env.NODE_ENV || 'localhost';
6+
const PORT = process.env.PORT || process.env.HTTPS_PORT || null;
67
// backward compatible
78
if (deployTarget === 'test') {
89
deployTarget = 'beta';
@@ -36,7 +37,7 @@ module.exports = {
3637
httpsOptions: {
3738
key: fs.readFileSync(path.join(__dirname, '/fielddb_debug.key'), 'utf8'),
3839
cert: fs.readFileSync(path.join(__dirname, '/fielddb_debug.crt'), 'utf8'),
39-
port: '3183',
40+
port: PORT || '3183',
4041
protocol: 'https://',
4142
},
4243
url: 'https://localhost:3183',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
},
6363
"scripts": {
6464
"docker:build": "docker build -t fielddb-auth .",
65-
"test:docker": "echo 'module.exports = { usersDbConnection: { url: \"http://couchdb:5984\" } };' > config/local.js && docker compose up -d && sleep 3 && docker compose logs && npm run setup && npm run test:deprecated:e2e",
66-
"test:docker:no-cache": "echo 'module.exports = { usersDbConnection: { url: \"http://couchdb:5984\" } };' > config/local.js && docker compose build --no-cache && docker compose up -d && sleep 15 && docker compose logs && npm run setup && npm run test:deprecated:e2e",
65+
"test:docker": "echo 'module.exports = { usersDbConnection: { url: \"http://couchdb:5984\" } };' > config/localhost.js && docker compose up -d && sleep 3 && docker compose logs && npm run setup && npm run test:deprecated:e2e",
66+
"test:docker:no-cache": "echo 'module.exports = { usersDbConnection: { url: \"http://couchdb:5984\" } };' > config/localhost.js && docker compose build --no-cache && docker compose up -d && sleep 15 && docker compose logs && npm run setup && npm run test:deprecated:e2e",
6767
"coverage": "NODE_ENV=test BUNYAN_LOG_LEVEL=FATAL nyc npm test",
6868
"lint": "eslint ",
6969
"lint:ci": "eslint .",

0 commit comments

Comments
 (0)