Skip to content

Commit 603289d

Browse files
committed
Merge branch 'main' of github.com:FieldDB/AuthenticationWebService into test/install
2 parents 1ab147f + 8dacd1d commit 603289d

80 files changed

Lines changed: 3649 additions & 34730 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Basic `dependabot.yml` file with
2+
# minimum configuration for three package managers
3+
4+
version: 2
5+
updates:
6+
# Enable version updates for npm
7+
- package-ecosystem: "npm"
8+
# Look for `package.json` and `lock` files in the `root` directory
9+
directory: "/"
10+
# Check the npm registry for updates every day (weekdays)
11+
schedule:
12+
interval: "daily"
13+
groups:
14+
default:
15+
patterns:
16+
- "*"
17+
18+
# Enable version updates for Docker
19+
- package-ecosystem: "docker"
20+
# Look for a `Dockerfile` in the `root` directory
21+
directory: "/"
22+
# Check for updates once a week
23+
schedule:
24+
interval: "weekly"
25+
26+
# Enable version updates for GitHub Actions
27+
- package-ecosystem: "github-actions"
28+
# Workflow files stored in the default location of `.github/workflows`
29+
# You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
30+
directory: "/"
31+
schedule:
32+
interval: "weekly"
33+
groups:
34+
default:
35+
patterns:
36+
- "*"

.github/workflows/auto-merge.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'FieldDB/AuthenticationWebService'
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v2
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Enable auto-merge for Dependabot PRs
19+
# if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
20+
run: gh pr merge --auto --merge "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v6
1717
- name: Build the Docker image
1818
run: "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" }};' > config/local.js && docker build . --file Dockerfile --tag fielddb-auth:$(date +%s)"

.github/workflows/node.js.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ on:
1010
branches: [ main ]
1111

1212
jobs:
13-
build:
13+
ci:
1414

1515
runs-on: ubuntu-latest
1616

1717
strategy:
1818
matrix:
19-
node-version: [12.x, 16.x]
19+
node-version: [24.x]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v6
2424
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v2
25+
uses: actions/setup-node@v6
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828
cache: 'npm'
@@ -35,6 +35,24 @@ jobs:
3535
with:
3636
github-token: ${{ secrets.GITHUB_TOKEN }}
3737

38-
- run: DEBUG='none' npm run docker:test
38+
- name: Create local config for tests
39+
run: |
40+
echo 'module.exports = { usersDbConnection: { url: "http://localhost:5984" }};' > config/local.js
41+
42+
- name: Start docker compose services
43+
run: docker compose up -d && sleep 5
44+
45+
- name: Show docker compose logs
46+
run: docker compose logs --no-color --timestamps || true
47+
48+
- name: Run setup
49+
run: npm run setup
50+
env:
51+
SOURCE_URL: ${{ secrets.SOURCE_URL }}
52+
DEBUG: 'none'
53+
54+
- name: Run tests
55+
run: npm run test:deprecated
3956
env:
4057
SOURCE_URL: ${{ secrets.SOURCE_URL }}
58+
DEBUG: 'none'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config/production.*
99
config/local.*
1010
etc
1111
Dockerfile-couchdb
12+
db
1213

1314
# Ignore natural lib
1415
public/libs/natural/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:12
1+
FROM node:24
22

33
# Create app directory
44
WORKDIR /usr/src/app

Dockerfile-couchdb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM couchdb:3.5.1
2+
3+
WORKDIR /
4+
5+
COPY etc/* /opt/couchdb/etc/
6+
7+
RUN set +x; \
8+
curl -X PUT http://admin:none@127.0.0.1:5984/_users; \
9+
curl -X PUT http://admin:none@127.0.0.1:5984/_replicator; \
10+
ls -alt /opt/couchdb/etc; \
11+
cat /opt/couchdb/etc/local.ini; \
12+
ls /opt/couchdb/etc/local.d;
13+
14+
# COPY fielddb_debug.* /usr/local/etc/couchdb

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ Edit your /etc/hosts to add an entry for example.org:
3030
127.0.0.1 corpusdev.example.org
3131
```
3232

33-
Turn on your local couchdb and make sure it is running on http://127.0.0.1:5984/_utils Record tests by adding `.only` on the tests you wish to record:
33+
Turn on your local couchdb and make sure it is running on http://127.0.0.1:5984/_utils Record tests by adding `.only` on the tests which show the error "refused: not recording and no network access":
3434

3535
```bash
36-
$ DEBUG=*user*,*nock*,*replay* REPLAY=record npm test
36+
$ SOURCE_URL:-https://public:none@corpusdev.other.org DEBUG=*user*,*nock*,*replay* REPLAY=record npm test
3737
```
3838

3939
As a result you should see a directory corresponding to the server, and files with-in it representing the requests:
4040

4141
```bash
4242
$ tree test/fixtures/
4343
test/fixtures/
44-
└── corpusdev.example.org-5984
44+
└── corpusdev.other.org-5984
4545
└── 154417467505825257
4646
```
4747

@@ -53,6 +53,25 @@ To run tests against the local instance:
5353
$ URL=https://localhost:3183 npm test
5454
```
5555

56+
### Running tests against a local couchdb
57+
58+
```bash
59+
$ npm run docker:test
60+
```
61+
62+
Turn off the docker container
63+
```bash
64+
$ docker compose stop
65+
$ docker compose rm -f
66+
```
67+
68+
Exec into the docker container
69+
70+
```bash
71+
$ docker container list
72+
$ docker exec -it cda63fa5d348 /bin/bash
73+
```
74+
5675
## Release History
5776
* v1.16 mongoose auth & everyauth
5877
* v1.32 switched to couchdb

auth_service.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const favicon = require('serve-favicon');
1919
const path = require('path');
2020

2121
/* Load modules provided by this codebase */
22-
const authenticationMiddleware = require('./middleware/authentication');
2322
const authWebServiceRoutes = require('./routes/routes');
2423
const { errorHandler } = require('./middleware/error-handler');
2524
const deprecatedRoutes = require('./routes/deprecated');
@@ -62,10 +61,6 @@ debug(`Accepting api version ${apiVersion}`);
6261
/**
6362
* Middleware
6463
*/
65-
// The example attaches it to the express
66-
// https://github.com/oauthjs/express-oauth-server#quick-start
67-
// service.oauth = oauthMiddleware;
68-
authWebService.use(authenticationMiddleware.jwt);
6964

7065
authWebService.use(favicon(path.join(__dirname, '/public/favicon.ico')));
7166
authWebService.use(bunyan({
@@ -105,12 +100,6 @@ authWebService.options('*', (req, res) => {
105100
}
106101
});
107102

108-
authWebService.use('/bower_components', express.static(path.join(__dirname,
109-
'/public/components/as-ui-auth/bower_components')));
110-
authWebService.use('/authentication', authenticationMiddleware.redirectAuthenticatedUser, express.static(path.join(__dirname, '/public/components/as-ui-auth/components')));
111-
authWebService.use('/authentication/register', authenticationMiddleware.redirectAuthenticatedUser,
112-
express.static(path.join(__dirname, '/public/components/as-ui-auth/components/signup')));
113-
114103
/**
115104
* Set up all the available URL authWebServiceRoutes see routes/routes.js for more details
116105
*/

0 commit comments

Comments
 (0)