Skip to content

Commit

Permalink
Move to cargo workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Jul 22, 2024
1 parent f02fe27 commit c544b85
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
with:
push: true
context: .
file: ./Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
file: ./orbit-server/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 3 additions & 33 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
[package]
name = "orbit"
license = "MIT"
edition = "2021"
version = "0.1.0"
authors = ["Miguel Piedrafita <[email protected]>"]

[dependencies]
axum = "0.7.5"
http = "1.1.0"
tar = "0.4.41"
slug = "0.1.5"
toml = "0.8.15"
anyhow = "1.0.71"
serde = "1.0.165"
flate2 = "1.0.30"
indexmap = "2.2.6"
dotenvy = "0.15.7"
tracing = "0.1.37"
reqwest = "0.12.5"
schemars = "0.8.12"
thiserror = "1.0.63"
serde_json = "1.0.99"
futures-util = "0.3.30"
async-fn-stream = "0.2.2"
uuid = { version = "1.10.0", features = ["v7"] }
tokio = { version = "1.29.1", features = ["full"] }
aide = { version = "0.13.4", features = ["axum", "scalar"] }
axum-jsonschema = { version = "0.8.0", features = ["aide"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }

[build-dependencies]
chrono = "0.4.26"
[workspace]
resolver = "2"
members = ["orbit-server"]
33 changes: 33 additions & 0 deletions orbit-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
license = "MIT"
edition = "2021"
version = "0.1.0"
name = "orbit-server"
authors = ["Miguel Piedrafita <[email protected]>"]

[dependencies]
axum = "0.7.5"
http = "1.1.0"
tar = "0.4.41"
slug = "0.1.5"
toml = "0.8.15"
anyhow = "1.0.71"
serde = "1.0.165"
flate2 = "1.0.30"
indexmap = "2.2.6"
dotenvy = "0.15.7"
tracing = "0.1.37"
reqwest = "0.12.5"
schemars = "0.8.12"
thiserror = "1.0.63"
serde_json = "1.0.99"
futures-util = "0.3.30"
async-fn-stream = "0.2.2"
uuid = { version = "1.10.0", features = ["v7"] }
tokio = { version = "1.29.1", features = ["full"] }
aide = { version = "0.13.4", features = ["axum", "scalar"] }
axum-jsonschema = { version = "0.8.0", features = ["aide"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }

[build-dependencies]
chrono = "0.4.26"
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/config.rs → orbit-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ impl Config {
Ok(config)
}

pub fn ensure_vars(self) -> Result<Self> {
if std::env::var("GITHUB_TOKEN").is_err() {
return Err(anyhow::anyhow!("GITHUB_TOKEN is not set"));
}

Ok(self)
}

pub fn extension(self) -> Extension<Sites> {
Extension(Arc::new(self.sites))
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs → orbit-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ async fn main() -> Result<()> {
)
.init();

let config = Config::load(env::var("ORBIT_CONFIG")?)?;
let config = Config::load(env::var("ORBIT_CONFIG")?)?.ensure_vars()?;
server::start(config).await
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c544b85

Please sign in to comment.