Skip to content

Commit 95aab6a

Browse files
committed
Load authenticator and MapAdapter types from config
1 parent 7bdc233 commit 95aab6a

Some content is hidden

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

43 files changed

+273
-291
lines changed

docs/source/explanations/access-control.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ from tiled.scopes import PUBLIC_SCOPES
7878
response_cache = cachetools.TTLCache(maxsize=10_000, ttl=60)
7979

8080

81-
class PASSAccessPolicy:
81+
class PASSAccessPolicy(AccessPolicy):
8282
"""
8383
access_control:
84-
access_policy: pass_access_policy:PASSAccessPolicy
85-
args:
86-
url: ...
87-
beamline: ...
84+
type: pass_access_policy:PASSAccessPolicy
85+
url: ...
86+
beamline: ...
8887
"""
8988

9089
def __init__(self, url, beamline, provider):

docs/source/explanations/security.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ authenticators:
280280
cara: ${CARA_PASSWORD}
281281
trees:
282282
- path: /
283-
tree:
283+
tree:
284284
type: tiled.examples.generated_minimal:tree
285285
```
286286

@@ -298,7 +298,7 @@ authenticators:
298298
type: tiled.authenticators:DummyAuthenticator
299299
trees:
300300
- path: /
301-
tree:
301+
tree:
302302
type: tiled.examples.generated_minimal:tree
303303
```
304304

docs/source/explanations/specialized-formats.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ Now take the following simple server configuration:
8585
# config.yml
8686
trees:
8787
- path: /
88-
tree:
88+
tree:
8989
type: tiled.catalog:from_uri
90-
args:
91-
uri: ./catalog.db
92-
readable_storage:
93-
- ./data/
94-
adapters_by_mimetype:
95-
application/x-xdi: tiled.examples.xdi:read_xdi
90+
uri: ./catalog.db
91+
readable_storage:
92+
- ./data/
93+
adapters_by_mimetype:
94+
application/x-xdi: tiled.examples.xdi:read_xdi
9695
```
9796
9897
and serve it:
@@ -207,12 +206,11 @@ Add new sections to the configuration as follows.
207206
```yaml
208207
trees:
209208
- path: /
210-
tree:
209+
tree:
211210
type: tiled.catalog:from_uri
212-
args:
213211
uri: ./catalog.db
214212
readable_storage:
215-
- ./data/
213+
- ./data/
216214
adapters_by_mimetype:
217215
application/x-xdi: tiled.examples.xdi:read_xdi
218216
media_types:

docs/source/how-to/custom-export-formats.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ media_types:
7474
# And provide some example data to try it with....
7575
trees:
7676
- path: /
77-
tree:
77+
tree:
7878
type: tiled.examples.generated_minimal:tree
7979
```
8080
@@ -175,7 +175,7 @@ media_types:
175175
image/jpeg: custom_exporters:to_jpeg
176176
trees:
177177
- path: /
178-
tree:
178+
tree:
179179
type: tiled.examples.generated_minimal:tree
180180
```
181181

docs/source/how-to/direct-client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ config = {
4545
"trees": [
4646
{
4747
"path": "/",
48-
"tree": "tiled.examples.generated_minimal:tree",
48+
"tree": {"type": "tiled.examples.generated_minimal:tree"},
4949
}
5050
}
5151
app = build_app_from_config(config)

docs/source/how-to/profiles.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,9 @@ my_profile:
171171
direct:
172172
trees:
173173
- path: /
174-
tree:
174+
tree:
175175
type: tiled.catalog:from_uri
176-
args:
177-
uri: "/path/to/catalog.db"
176+
uri: "/path/to/catalog.db"
178177
```
179178
180179
This takes the place of the `uri:` parameter. A profile must contain
@@ -188,10 +187,9 @@ my_profile:
188187
direct:
189188
trees:
190189
- path: /
191-
tree:
192-
type: tiled.catalog:from_uri
193-
args:
194-
directory: "/path/to/catalog.db"
190+
tree:
191+
type: tiled.catalog:from_uri
192+
directory: "/path/to/catalog.db"
195193
cache:
196194
capacity: 2_000_000_000 # 2 GB
197195
```

docs/source/how-to/read-custom-formats.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,13 @@ needed.
244244
# config.yml
245245
trees:
246246
- path: /
247-
tree:
247+
tree:
248248
type: catalog
249-
args:
250-
uri: ./catalog.db
251-
readable_storage:
252-
- path/to/directory
253-
adapters_by_mimetype:
254-
application/x-stuff: custom:read_custom_format
249+
uri: ./catalog.db
250+
readable_storage:
251+
- path/to/directory
252+
adapters_by_mimetype:
253+
application/x-stuff: custom:read_custom_format
255254
```
256255
257256
We then use the configuration file like this:

example_configs/google_auth.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ authenticators:
1212
trees:
1313
# Just some arbitrary example data...
1414
# The point of this example is the authentication above.
15-
- tree:
15+
- tree:
1616
type: tiled.examples.generated_minimal:tree
1717
path: /

example_configs/multiple_providers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ authenticators:
2222
cara: ${CARA_PASSWORD}
2323
trees:
2424
- path: /
25-
tree:
25+
tree:
2626
type: tiled.examples.toy_authentication:tree

example_configs/orcid_auth.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ authenticators:
1212
trees:
1313
# Just some arbitrary example data...
1414
# The point of this example is the authenticaiton above.
15-
- tree:
15+
- tree:
1616
type: tiled.examples.generated_minimal:tree
1717
path: /

0 commit comments

Comments
 (0)