Skip to content

Commit 10e9aae

Browse files
committed
feat: support kebab-case and snake_case for fields in namespace config
1 parent 0a45649 commit 10e9aae

5 files changed

Lines changed: 88 additions & 86 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ set -a; source .env
7575
curl -v -X POST 127.0.0.1:8081/execute_skill \
7676
-H "Authorization: Bearer $PHARIA_AI_TOKEN" \
7777
-H 'Content-Type: application/json' \
78-
-d '{"skill":"pharia_kernel_team/greet_skill", "input":"Homer"}'
78+
-d '{"skill":"pharia-kernel-team/greet_skill", "input":"Homer"}'
7979
```
8080

8181
## User manual

operator-config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[namespaces.pharia_kernel_team]
1+
[namespaces.pharia-kernel-team]
22
# The URL to the configuration listing the skills of this namespace
33
# Pharia kernel will use the contents of the `NAMESPACES__PHARIA_KERNEL_TEAM__CONFIG_ACCESS_TOKEN` environment variable to access (authorize) the config
44
config_url = "https://gitlab.aleph-alpha.de/api/v4/projects/966/repository/files/config.toml/raw?ref=main"
55

66
# Registry to load skills from
77
# Pharia kernel will use the contents of the `NAMESPACES__PHARIA_KERNEL_TEAM__REGISTRY__USER` and `NAMESPACES__PHARIA_KERNEL_TEAM__REGISTRY__PASSWORD` environment variables to access (authorize) the registry
8-
[namespaces.pharia_kernel_team.registry]
8+
[namespaces.pharia-kernel-team.registry]
99
type = "oci"
1010
name = "registry.gitlab.aleph-alpha.de"
1111
repository = "engineering/pharia-skills/skills"

src/namespace_watcher/actor.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ impl NamespaceDescriptionLoaders {
3434
config
3535
.loader()
3636
.with_context(|| {
37-
format!("Unable to load configuration of namespace: '{namespace}'")
37+
format!("Unable to load configuration of namespace: '{namespace:?}'")
3838
})
39-
.map(|loader| (namespace, loader))
39+
.map(|loader| (namespace.into_string(), loader))
4040
})
4141
.collect::<anyhow::Result<HashMap<_, _>>>()?;
4242
Ok(Self { namespaces })
@@ -264,6 +264,7 @@ pub mod tests {
264264
use tokio::sync::{mpsc, Mutex};
265265
use tokio::time::timeout;
266266

267+
use crate::namespace_watcher::config::Namespace;
267268
use crate::namespace_watcher::tests::NamespaceConfig;
268269
use crate::skill_store::tests::SkillStoreMessage;
269270
use crate::skills::SkillPath;
@@ -407,7 +408,7 @@ pub mod tests {
407408
async fn watch_skills_in_empty_directory() {
408409
let temp_dir = tempdir().unwrap();
409410
let namespaces = [(
410-
"local".to_owned(),
411+
Namespace::new("local"),
411412
NamespaceConfig::Watch {
412413
directory: temp_dir.path().to_owned(),
413414
},
@@ -430,7 +431,7 @@ pub mod tests {
430431
fs::File::create(directory.join("skill_1.wasm")).unwrap();
431432
fs::File::create(directory.join("skill_2.wasm")).unwrap();
432433
let namespaces = [(
433-
"local".to_owned(),
434+
Namespace::new("local"),
434435
NamespaceConfig::Watch {
435436
directory: directory.to_owned(),
436437
},

0 commit comments

Comments
 (0)