Skip to content

Commit

Permalink
[docs] Simplify configs by using serviceType and more INHERITS.
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-pmb committed Apr 26, 2024
1 parent 8c902dd commit a45dbae
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 79 deletions.
12 changes: 12 additions & 0 deletions docs/cfg/ubhd-ex01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ Structure
This will be explained below in section "Config merging".



Config fragments
----------------

* In some places, configs can __inherit fragments__ from files in the
`custom_data` topic by specifying a key named `INHERITS` which must
be a string or a list of strings. Each string is a __fragment path__,
specified using the [`objdive` path syntax](https://npm.im/objdive).
The first path segment refers to an entry name in the `custom_data` topic.



Available config topics
-----------------------

Expand Down
30 changes: 5 additions & 25 deletions docs/cfg/ubhd-ex01/acl_chains/logged_in_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
# decide:
# shutdown: deny


- if: always
aclSubChain:
- '?useracl_<$userId>'
- '?svcacl_<$serviceId>'


- if:
memberOfAclGroup: 'doi_sources'
decide:
Expand All @@ -31,24 +24,11 @@
decide:
search_hasStamp__ubhd_doiAssign: allow


- param: 'serviceId'
if:
paramInList:
- 'diglit'
- 'klorsch-bib'
- 'klorsch-archiv'
aclSubChain: 'diglit-like_services'


- param: 'serviceId'
if:
paramInList:
- 'journals'
aclSubChain: 'journal-like_services'



- if: always
aclSubChain:
- '?useracl_<$userId>'
- '?svcacl_<$serviceId>'
- '<$serviceType>_services'



Expand Down
2 changes: 2 additions & 0 deletions docs/cfg/ubhd-ex01/acl_chains/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@


- if: isLoggedIn
unless:
slotEmpty: serviceType
aclSubChain: logged_in_users


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Group name. `^` means to use the basename of the filename.
^:

usernames:
# You can also declare group membership in a user config file.
Expand Down
49 changes: 49 additions & 0 deletions docs/cfg/ubhd-ex01/custom_data/svctpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
%YAML 1.2
# -*- coding: UTF-8, tab-width: 4 -*-
---

^:
# This data is used for `INHERITS` in service config example files.

approvalFeed:
type: 'approval'
feedTitle: 'Annos waiting for approval' # optional

linkTpl: '/static/local/redir/approve-anno.html?%as'
# Many RSS readers require an absolute URL. Our RSS formatter
# will thus replace a leading slash with its public base URL.
# For available slots, see `src/hnd/anno/rssLinkSlots.mjs`.


diglit-like:
targetUrlMetadata:
vSubDirs:
- 'projectName'
- 'pageNumStr'
# vSubDir = virtual subdirectory maps parts of the URL into the
# ACL meta data namespace, so you can use it in ACL conditions.
# They will also be displayed in "access denied" error messages
# to help debug the conitions that caused the error.

staticAclMeta:
serviceType: 'diglit-like'



journals-like:
targetUrlMetadata:
vSubDirs:
- 'zsKuerzel'
- null # expected to always be 'article'
- null # expected to always be 'view'
- 'submissionId'

staticAclMeta:
serviceType: 'journals-like'






...
39 changes: 39 additions & 0 deletions docs/cfg/ubhd-ex01/services/0_defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.2
# -*- coding: UTF-8, tab-width: 4 -*-
---

'':
annoBrowserRedirect: '%sc/%bi/image,info'
# ^-- For available slots, see `src/hnd/anno/browserRedirect.mjs`

approvalRequired: true

autoRequestNextVersionDoi: true
# ^- If enabled, when a revision is submitted for a version that has
# a DOI, a DOI request is stamped onto the newly submitted version.


rssFeeds:
'': # <- Empty sub URL = Defaults for all feeds for this service.
# And since this is in the service defaults, these settings
# will set the defaults for all feeds in all services.

keyHash: ''
# Empty key hash disables access to the feed.
# This is usually a good default because usually you want a
# different key for each feed.
# For your convenience, we include a bcrypt token generator:
# `../../../../util/create_bcrypt_rss_token.sh`

# prefix: 'https://…'
# ^-- When omitted, assumes `1` (the number); and numbers
# denote the n-th item from targetUrlMetadata.
# Thus, omitting the prefix means to use the first
# targetUrlMetadata prefix URL.






...
3 changes: 1 addition & 2 deletions docs/cfg/ubhd-ex01/services/anno-frontend-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Service name. `^` means to use the basename of the filename.

^:
targetUrlMetadata:
prefixes:
- 'http://anno.test/'
Expand Down
35 changes: 4 additions & 31 deletions docs/cfg/ubhd-ex01/services/diglit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,26 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Service name. `^` means to use the basename of the filename.
^:
INHERITS: 'svctpl.diglit-like'

targetUrlMetadata:
prefixes:
- 'https://digi.ub.uni-heidelberg.de/diglit/'
# Example annotation: 0b3c9340-11f7-3ec8-8721-09504062a007
vSubDirs:
- 'projectName'
- 'pageNumStr'
# vSubDir = virtual subdirectory maps parts of the URL into the
# ACL meta data namespace, so you can use it in ACL conditions.
# They will also be displayed in "access denied" error messages
# to help debug the conitions that caused the error.


annoBrowserRedirect: '%sc/%bi/image,info'
# ^-- For available slots, see `src/hnd/anno/browserRedirect.mjs`

approvalRequired: yes

autoRequestNextVersionDoi: yes
# ^- If enabled, when a revision is submitted for a version that has
# a DOI, a DOI request is stamped onto the newly submitted version.



rssFeeds:

team23: # <- The sub URL (inside /rssb) of this feed
INHERITS: 'svctpl.approvalFeed'
keyHash: '$2y$05$pumfI6EZRlq/Od5zPfjefOPYIwDDswZ0IzT409Ww6ekF7GrD8iTPm'
# Example plaintext token is: `xmUndc5rSLjp9a81FBbmWesgVwZobm1O`
# => URL will be /rssb/team23?key=xmUn…
# For your convenience, we include a bcrypt token generator:
# `../../../../util/create_bcrypt_rss_token.sh`

type: 'approval'

# prefix: 'https://…'
# ^-- When omitted, assumes `1` (the number); and numbers denote
# the n-th item from targetUrlMetadata. Thus, omitting the
# prefix means to use the first targetUrlMetadata prefix URL.

feedTitle: 'DigLit annos waiting for approval' # optional

linkTpl: '/static/local/redir/approve-anno.html?%as'
# Many RSS readers require an absolute URL. Our RSS formatter
# will thus replace a leading slash with its public base URL.




Expand Down
13 changes: 13 additions & 0 deletions docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%YAML 1.2
# -*- coding: UTF-8, tab-width: 4 -*-
---

^:
INHERITS: 'svctpl.diglit-like'

targetUrlMetadata:
prefixes:
- 'https://digi.hadw-bw.de/view/'


...
9 changes: 2 additions & 7 deletions docs/cfg/ubhd-ex01/services/journals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Service name. `^` means to use the basename of the filename.
^:
INHERITS: 'svctpl.diglit-like'

targetUrlMetadata:
prefixes:
- 'http://journals.ub.uni-heidelberg.de/index.php/'
- 'https://journals.ub.uni-heidelberg.de/index.php/'
# … arch-inf/article/view/81388
# Example annotation: btwujJsWTBWL-IYNk-1raQ
vSubDirs:
- 'zsKuerzel'
- null # expected to always be 'article'
- null # expected to always be 'view'
- 'submissionId'


...
6 changes: 2 additions & 4 deletions docs/cfg/ubhd-ex01/services/klorsch-archiv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Service name. `^` means to use the basename of the filename.
^:
INHERITS: 'svctpl.diglit-like'

targetUrlMetadata:
prefixes:
- 'https://archivum-laureshamense-digital.de/view/'
# Example annotations: a10a4cf67a aea8699a8e ef5d92d228 fb25d8d0a6
vSubDirs:
- 'projectName'
- 'pageNumStr'


...
6 changes: 2 additions & 4 deletions docs/cfg/ubhd-ex01/services/klorsch-bib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

^: # <-- Service name. `^` means to use the basename of the filename.
^:
INHERITS: 'svctpl.diglit-like'

targetUrlMetadata:
prefixes:
- 'https://bibliotheca-laureshamensis-digital.de/bav/'
# Example annotation: 3d82c273-c104-3023-90dc-bb48f0d4ba87
vSubDirs:
- 'projectName'
- 'pageNumStr'


...
2 changes: 1 addition & 1 deletion docs/cfg/ubhd-ex01/users/0_guess_author.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !!


'': # <-- Empty username = not a user but server-wide settings.
'':

missing_author_fallback_identity_keys:
# This option is the stopgap described above.
Expand Down
2 changes: 1 addition & 1 deletion docs/cfg/ubhd-ex01/users/0_mgr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: UTF-8, tab-width: 4 -*-
---

'': # <-- Empty username = not a user but server-wide settings.
'':

author_agent_uuid5_baseurl:
''
Expand Down
4 changes: 1 addition & 3 deletions docs/cfg/ubhd-ex01/users/arno.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,11 @@
- 'svc_diglit/publisher'
- 'svc_journals/author'
- 'svc_journals/publisher'
- 'doi_sources'

# You can also declare group membership in a group config file.
# Membership declarations merge cumulatively, so this is redundant:
- 'svc_diglit/proofreaders'

- 'doi_request_watchers'
- 'doi_sources'


upstream_userid_aliases:
Expand Down

0 comments on commit a45dbae

Please sign in to comment.