From 41268fe36181b3c2840ad9bed17657bd67990c8d Mon Sep 17 00:00:00 2001 From: Enola Knezevic Date: Fri, 5 Apr 2024 15:56:29 +0200 Subject: [PATCH 1/3] updated readme with catalogue etc. --- README.md | 42 +++++++++++++++++++++++++++++++++++++++++- src/config.rs | 2 +- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7816f16..fc2e626 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,35 @@ This is the Rust re-implementation of Samply.Spot. ## Local setup Spot can be run locally with the provided [docker-compose](./docker-compose.yml) which requires a running beam installation. This can be done by cloning the [beam repository](https://github.com/samply/beam) and running `./dev/beamdev demo` +Spot can also be run from command line stating command parameters, like so: +```bash +cargo run -- --beam-proxy-url http://localhost:8081 --beam-app-id app1.proxy1.broker --beam-secret App1Secret --cors-origin any --bind-addr 127.0.0.1:8055 --catalogue-url https://raw.githubusercontent.com/samply/lens/main/packages/demo/public/catalogues/catalogue-dktk.json +``` + +The following environment variables are mandatory for the usage of Spot. +``` +--beam-proxy-url + URL of the Beam Proxy, e.g. https://proxy1.broker.samply.de [env: BEAM_PROXY_URL=] +--beam-app-id + Beam AppId of this application, e.g. spot.proxy1.broker.samply.de [env: BEAM_APP_ID=] +--beam-secret + Credentials to use on the Beam Proxy [env: BEAM_SECRET=] +--cors-origin + Where to allow cross-origin resourse sharing from [env: CORS_ORIGIN=] +``` + +Optional environment variables: +``` +--project + Optional project name used by focus [env: PROJECT=] +--catalogue-url + URL to catalogue.json file, if not stated, /catalogue endpoint is disabled [env: CATALOGUE_URL=] +--prism-url + URL to prism, if catalogue-url is not stated, this is never used [env: PRISM_URL=] [default: http://localhost:8066] +--bind-addr + The socket address this server will bind to [env: BIND_ADDR=] [default: 0.0.0.0:8055] +``` + ## API ### /beam @@ -38,7 +67,7 @@ Date: Mon, 15 Mai 2023 13:00:00 GMT ``` #### GET -The get endpoint takes an beam task id in the path. +The get endpoint takes a beam task id in the path. ``` shell curl http://localhost:8100/beam/ @@ -46,6 +75,17 @@ curl http://localhost:8100/beam/ See the example [call](./docs/listen-for-beam-results.sh) +### /catalogue + +#### GET + +``` shell +curl http://localhost:8100/catalogue +``` + +Returns JSON catalogue of search criteria and the expected number of results in sites configured in Samply/Prism. + + ## License This code is licensed under the Apache License 2.0. For details, please see [LICENSE](./LICENSE) diff --git a/src/config.rs b/src/config.rs index 5dbd051..b272e0e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,7 +20,7 @@ pub struct Config { #[clap(long, env)] pub beam_secret: String, - /// Credentials to use on the Beam Proxy + /// Where to allow cross-origin resourse sharing from #[clap(long, env, value_parser = parse_cors)] pub cors_origin: AllowOrigin, From 9f6c248650ec46ba6dc1d03416497cf490037d63 Mon Sep 17 00:00:00 2001 From: Enola Knezevic Date: Fri, 5 Apr 2024 15:59:32 +0200 Subject: [PATCH 2/3] word --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc2e626..c7fac6c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This is the Rust re-implementation of Samply.Spot. ## Local setup Spot can be run locally with the provided [docker-compose](./docker-compose.yml) which requires a running beam installation. This can be done by cloning the [beam repository](https://github.com/samply/beam) and running `./dev/beamdev demo` -Spot can also be run from command line stating command parameters, like so: +Spot can also be run from command line stating command line parameters, like so: ```bash cargo run -- --beam-proxy-url http://localhost:8081 --beam-app-id app1.proxy1.broker --beam-secret App1Secret --cors-origin any --bind-addr 127.0.0.1:8055 --catalogue-url https://raw.githubusercontent.com/samply/lens/main/packages/demo/public/catalogues/catalogue-dktk.json ``` From 6619b994269ca15ea50384bfaae79e8879e43c45 Mon Sep 17 00:00:00 2001 From: Enola Knezevic <115070135+enola-dkfz@users.noreply.github.com> Date: Mon, 8 Apr 2024 09:24:44 +0200 Subject: [PATCH 3/3] Update README.md Co-authored-by: Martin Lablans <6804500+lablans@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c7fac6c..18e8c12 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ See the example [call](./docs/listen-for-beam-results.sh) curl http://localhost:8100/catalogue ``` -Returns JSON catalogue of search criteria and the expected number of results in sites configured in Samply/Prism. +Returns JSON catalogue of search criteria along with metadata fetched from Samply.Prism (see [Prism's repository](https://github.com/samply/prism) for a list of metadata fields). ## License