Skip to content

Commit

Permalink
feat: move catalog config to toml
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Oct 28, 2024
1 parent c158090 commit 1a9e57b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[catalog]
type = "Catalog" # will this be unnecessary once https://github.com/stac-utils/stac-rs/pull/498 is released?
stac_version = "1.1.0"
id = "heystac"
description = "A curated geospatial asset discovery experience™"
links = []

[catalogs.microsoft-pc]
href = "https://planetarycomputer.microsoft.com/api/stac/v1"
title = "Microsoft Planetary Computer"
Expand Down
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ use std::{
path::Path,
};

const CATALOG_ID: &str = "heystac";
const CATALOG_DESCRIPTION: &str = "A curated geospatial asset discovery experience™";

#[derive(Debug, Deserialize)]
pub struct Config {
catalog: Catalog,
catalogs: HashMap<String, CatalogConfig>,
}

Expand All @@ -32,7 +30,7 @@ impl Config {
}

pub fn write_catalog(&self, path: impl AsRef<Path>) -> Result<()> {
let mut catalog = Catalog::new(CATALOG_ID, CATALOG_DESCRIPTION);
let mut catalog = self.catalog.clone();
for (id, catalog_config) in &self.catalogs {
let mut link =
Link::child(&catalog_config.href).title(Some(catalog_config.title.clone()));
Expand Down

0 comments on commit 1a9e57b

Please sign in to comment.