Skip to content

Commit ccadaf8

Browse files
committed
Initial development of resource-info-fetcher
1 parent 172e18b commit ccadaf8

34 files changed

Lines changed: 790 additions & 151 deletions

File tree

Cargo.lock

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ tar = "0.4"
4747
tokio = { version = "1.52", features = ["full"] }
4848
tracing = "0.1"
4949
url = "2.5"
50+
urlencoding = "2.1"
5051
uuid = "1.10"
5152

5253
[patch."https://github.com/stackabletech/operator-rs.git"]

Tiltfile

Lines changed: 0 additions & 54 deletions
This file was deleted.

_TEST/clientId

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__datahub_system

_TEST/clientSecret

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
datahub-demo-system-secret

_TEST/rif.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"backend": {
3+
"dataHub": {
4+
"hostname": "localhost",
5+
"port": 8080
6+
}
7+
}
8+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "info-fetcher-commons"
3+
description = "Common shared code between info fetchers"
4+
version.workspace = true
5+
authors.workspace = true
6+
license.workspace = true
7+
edition.workspace = true
8+
repository.workspace = true
9+
publish = false
10+
11+
[dependencies]
12+
stackable-operator.workspace = true
13+
14+
axum.workspace = true
15+
hyper.workspace = true
16+
native-tls.workspace = true
17+
reqwest.workspace = true
18+
rustls-pki-types.workspace = true
19+
serde.workspace = true
20+
serde_json.workspace = true
21+
snafu.workspace = true
22+
tokio.workspace = true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use std::{
2+
fs::File,
3+
io::BufReader,
4+
path::{Path, PathBuf},
5+
};
6+
7+
use serde::de::DeserializeOwned;
8+
use snafu::{ResultExt, Snafu};
9+
10+
#[derive(Snafu, Debug)]
11+
pub enum ConfigError {
12+
#[snafu(display("failed to open config file from {path:?}"))]
13+
OpenFile {
14+
source: std::io::Error,
15+
path: PathBuf,
16+
},
17+
18+
#[snafu(display("unable to read config file from {path:?}"))]
19+
ParseConfigFile {
20+
source: serde_json::Error,
21+
path: PathBuf,
22+
},
23+
}
24+
25+
pub fn read_config_file<C>(path: &Path) -> Result<C, ConfigError>
26+
where
27+
C: DeserializeOwned,
28+
{
29+
let file = File::open(path).with_context(|_| OpenFileSnafu { path })?;
30+
let reader = BufReader::new(file);
31+
32+
serde_json::from_reader(reader).with_context(|_| ParseConfigFileSnafu { path })
33+
}
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod config;
2+
pub mod http_error;
3+
pub mod utils;

0 commit comments

Comments
 (0)