Skip to content

Commit 86fd9a5

Browse files
committed
feat(stac-cli): auto create collections when serving
1 parent 397ce33 commit 86fd9a5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

stac-cli/src/args.rs

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ pub struct ServeArgs {
151151
/// The pgstac connection string.
152152
#[arg(long)]
153153
pub pgstac: Option<String>,
154+
155+
/// Don't auto-create collections for items that are missing them.
156+
#[arg(short, long)]
157+
pub dont_auto_create_collections: bool,
154158
}
155159

156160
/// Arguments for sorting a STAC value.

stac-cli/src/subcommand/serve.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ impl Subcommand {
1212
{
1313
let mut backend = stac_server::PgstacBackend::new_from_stringlike(pgstac).await?;
1414
if !args.href.is_empty() {
15-
backend.add_from_hrefs(&args.href).await?;
15+
backend
16+
.add_from_hrefs(&args.href, !args.dont_auto_create_collections)
17+
.await?;
1618
}
1719
let api = Api::new(backend, root)?;
1820
let router = stac_server::routes::from_api(api);
@@ -29,7 +31,9 @@ impl Subcommand {
2931
} else {
3032
let mut backend = MemoryBackend::new();
3133
if !args.href.is_empty() {
32-
backend.add_from_hrefs(&args.href).await?;
34+
backend
35+
.add_from_hrefs(&args.href, !args.dont_auto_create_collections)
36+
.await?;
3337
}
3438
let api = Api::new(backend, root)?;
3539
let router = stac_server::routes::from_api(api);

0 commit comments

Comments
 (0)