Skip to content

Commit

Permalink
Rename manifest fields, add example setting (#4)
Browse files Browse the repository at this point in the history
* rename manifest fields, add example setting

* update settings documentation (using manifest syntax)
  • Loading branch information
alexcasalboni authored Feb 13, 2025
1 parent 55e81e0 commit d2d244e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
20 changes: 11 additions & 9 deletions dc_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ class DataCollection(exports.DataCollection):
'''
def page(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
'''
settings is a list of tuple, which contains each key and secret for the provider
for example, if your component is set to use
[[components.data_collection]]
name = "my_component"
component = "outpout.wasm"
settings.test_project_id = "123456789"
settings.test_write_key = "abcdefg"
settings will be [("test_project_id", "123456789"), ("test_write_key", "abcdefg")]
settings is a list of tuple, which contains each key and value for the provider
for example, if your component define this setting:
[component.settings.example]
title = "Example Config Field"
type = "string"
settings will be [("example", "value")], so you can access its value as follows:
example_value = dict(settings)['example']
'''
'''
the function should return the following:
Expand Down
8 changes: 6 additions & 2 deletions edgee-component.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifest_version = 1

[package]
[component]
name = "example-py-component"
version = "1.0.0"
category = "data-collection"
Expand All @@ -10,6 +10,10 @@ documentation = "https://github.com/edgee-cloud/example-py-component"
repository = "https://github.com/edgee-cloud/example-py-component"
wit-world-version = "0.4.0"

[package.build]
[component.build]
command = "uv sync && uv run componentize-py --wit-path wit/ bindings edgee_world && uv run componentize-py --wit-path wit/ --world data-collection componentize dc_component -o dc_component.wasm"
output_path = "./dc_component.wasm"

[component.settings.example]
title = "Example Config Field"
type = "string"

0 comments on commit d2d244e

Please sign in to comment.