Skip to content

Commit

Permalink
PROCESS: CouchDB is up to date.
Browse files Browse the repository at this point in the history
  • Loading branch information
benel committed Dec 11, 2023
1 parent e7c12f7 commit fd51e81
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 21 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install and run Argos with test data
run: docker-compose up -d
run: |
export COUCHDB_USER="TO_BE_CHANGED"
export COUCHDB_PASSWORD="TO_BE_CHANGED"
docker-compose up -d
- name: Install test tools
run: npm install
- uses: nev7n/wait_for_response@v1
- name: Wait for database service
uses: docker://benel/wait-for-response:1
with:
url: http://localhost/
responseCode: 200
args: http://localhost:5984/argos 401 5000 500
- name: Enable public access
run: |
export COUCHDB_USER="TO_BE_CHANGED"
export COUCHDB_PASSWORD="TO_BE_CHANGED"
curl -X PUT -u "${COUCHDB_USER}:${COUCHDB_PASSWORD}" -s localhost:5984/hyperglosae/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
- name: Run tests
run : npm test
shell: 'script -q -e -c "bash {0}"'
8 changes: 4 additions & 4 deletions app/lists/topicV1.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ function(head, req) {
}
}
send('<topic name="'+util.xmlencode(name)+'">\n');
for each (b in broader) {
for (let b of broader) {
send('<relatedTopic href="'+b.id+'" relationType="includedIn">');
send(b.name);
send('</relatedTopic>\n');
}
for each (n in narrower) {
for (let n of narrower) {
send('<relatedTopic href="'+n.id+'" relationType="includes">');
send(n.name);
send('</relatedTopic>\n');
}
for each (i in items) {
for (let i of items) {
send('<entity href="../../../entity/'+util.urlencode(i.corpus)+"/"+i.id+'"/>\n');
}
for each (h in highlights) {
for (let h of Object.values(highlights)) {
send('<entity href="../../../entity/'+util.urlencode(h.corpus)+"/"+h.item+"/");
send(format(h.coordinates)+'">');
send(util.xmlencode(h.text));
Expand Down
2 changes: 1 addition & 1 deletion app/lists/viewpointV1.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function(head, req) {
}
}
send('<viewpoint name="'+name+'">\n');
for each (t in topics) {
for (let t of Object.values(topics)) {
send('<topic href="topic/'+t.id+'">'+t.name+'</topic>\n');
}
send('</viewpoint>\n');
Expand Down
4 changes: 2 additions & 2 deletions app/views/attribute/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function(o) {
[o.item_corpus, key, value],
{item:{id:o._id, name: o.item_name}}
);
} else {
for each (v in value) {
} else { //array
for (let v of value) {
emit(
[o.item_corpus, key, v],
{item:{id:o._id, name: o.item_name}}
Expand Down
2 changes: 1 addition & 1 deletion app/views/fragmentV1/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(o) {
return result;
}

for each (h in o.highlights) {
for (let h of Object.values(o.highlights)) {
emit([o._id, format(h.coordinates)], {
text: h.text,
viewpoint: h.viewpoint,
Expand Down
2 changes: 1 addition & 1 deletion app/views/user/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(o) {
for each (u in o.users) {
for (let u of o.users) {
if (o.viewpoint_name) {
emit([u], {viewpoint:{id:o._id, name:o.viewpoint_name}});
} else if (o.corpus_name) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/viewpoint/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function(o) {
id:t,
name:topics[t].name
});
} else for each(b in broader) {
} else for (let b of broader) {
broaderArray.push({
id:b,
name:topics[b].name
Expand Down
4 changes: 2 additions & 2 deletions app/views/viewpointV1/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function(o) {
//viewpoint name
emit([o._id], {name:o.viewpoint_name});
//viewpoint users
for each (var u in o.users) {
for (let u of o.users) {
emit([o._id], {user:u});
}
//topics
Expand All @@ -15,7 +15,7 @@ function(o) {
var broader = topics[t].broader;
if (broader==null || broader.length==0) {
emit([o._id], {upper:{id:t, name:topics[t].name}});
} else for each(b in broader) {
} else for (let b of broader) {
emit([o._id, t], {broader: {id:b, name:topics[b].name}});
emit([o._id, b], {narrower: {id:t, name:topics[t].name}});
}
Expand Down
4 changes: 2 additions & 2 deletions conf/couchdb.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[httpd]
bind_address = any
secure_rewrites = false ; To use CouchDB users as Argos users

[chttpd]
bind_address = any
authentication_handlers = {chttpd_auth, cookie_authentication_handler}, {chttpd_auth, proxy_authentication_handler}, {chttpd_auth, default_authentication_handler}
secure_rewrites = false ; To use CouchDB users as Argos users

[couch_httpd_auth]
[chttpd_auth]
secret = TO_BE_CHANGED
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ version: '3'
services:

couchdb:
image: couchdb:2
image: couchdb:3
ports:
- 5984:5984
environment:
- COUCHDB_USER=${COUCHDB_USER}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD}
volumes:
- ./data:/opt/couchdb/data
- ./conf/couchdb.ini:/opt/couchdb/etc/local.d/docker.ini
Expand All @@ -30,7 +33,7 @@ services:
image: benel/couchapp
command: pushdocs .
environment:
- URI=http://couchdb:5984/argos
- URI=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984/argos
volumes:
- ./__tests__/api/fixtures:/app
depends_on:
Expand All @@ -40,7 +43,7 @@ services:
image: benel/couchapp
command: push .
environment:
- URI=http://couchdb:5984/argos
- URI=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984/argos
volumes:
- ./app:/app
depends_on:
Expand Down

0 comments on commit fd51e81

Please sign in to comment.