Skip to content

Commit

Permalink
fix: more removals of shuttle-secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Mar 18, 2024
1 parent 8cc5f7b commit e44b174
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion axum/oauth2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.183", features = ["derive"] }
shuttle-axum = "0.42.0"
shuttle-runtime = "0.42.0"
shuttle-secrets = "0.42.0"
shuttle-shared-db = { version = "0.42.0", features = ["postgres", "sqlx"] }
sqlx = { version = "0.7.2", features = ["runtime-tokio-rustls", "macros", "chrono"] }
thiserror = "1.0.57"
Expand Down
4 changes: 2 additions & 2 deletions axum/oauth2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use axum_extra::extract::cookie::Key;
use oauth2::{basic::BasicClient, AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl};
use reqwest::Client;
use routes::oauth;
use shuttle_secrets::SecretStore;
use shuttle_runtime::SecretStore;
use sqlx::PgPool;
pub mod routes;

Expand All @@ -24,7 +24,7 @@ impl FromRef<AppState> for Key {
#[shuttle_runtime::main]
async fn axum(
#[shuttle_shared_db::Postgres] db: PgPool,
#[shuttle_secrets::Secrets] secrets: SecretStore,
#[shuttle_runtime::Secrets] secrets: SecretStore,
) -> shuttle_axum::ShuttleAxum {
sqlx::migrate!()
.run(&db)
Expand Down
2 changes: 1 addition & 1 deletion other/standalone-binary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ All startup logic is placed in the binary source files, while the implementation
- `src/bin/shuttle.rs` is the main binary with Shuttle, run with `cargo shuttle run`. Note that the `[[bin]]` entry in `Cargo.toml` needs to have the same name as the crate. The file can have any name you want.
- `src/bin/standalone.rs` is without Shuttle, run with `cargo run --bin standalone` (you can change the name)

This example shows how to use separate logic for getting secrets (`shuttle-secrets` vs homemade solution), but the same approach can be applied to other resources that are initiated by Shuttle's main function.
This example shows how to use separate logic for getting secrets (Shuttle secrets vs homemade solution), but the same approach can be applied to other resources that are initiated by Shuttle's main function.
4 changes: 1 addition & 3 deletions rocket/secrets/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ struct MyState {
}

#[shuttle_runtime::main]
async fn rocket(
#[shuttle_runtime::Secrets] secrets: SecretStore,
) -> shuttle_rocket::ShuttleRocket {
async fn rocket(#[shuttle_runtime::Secrets] secrets: SecretStore) -> shuttle_rocket::ShuttleRocket {
// get secret defined in `Secrets.toml` file.
let secret = secrets.get("MY_API_KEY").context("secret was not found")?;

Expand Down
1 change: 0 additions & 1 deletion serenity/weather-forecast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ reqwest = { version = "0.11.24", features = ["json"] }
serde = "1.0.197"
serenity = { version = "0.12.0", default-features = false, features = ["client", "gateway", "rustls_backend", "model"] }
shuttle-runtime = "0.42.0"
shuttle-secrets = "0.42.0"
shuttle-serenity = "0.42.0"
tokio = "1.26.0"
tracing = "0.1.37"
4 changes: 2 additions & 2 deletions serenity/weather-forecast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serenity::builder::{
};
use serenity::model::gateway::Ready;
use serenity::prelude::*;
use shuttle_secrets::SecretStore;
use shuttle_runtime::SecretStore;
use tracing::info;

struct Bot {
Expand Down Expand Up @@ -87,7 +87,7 @@ impl EventHandler for Bot {

#[shuttle_runtime::main]
async fn serenity(
#[shuttle_secrets::Secrets] secret_store: SecretStore,
#[shuttle_runtime::Secrets] secret_store: SecretStore,
) -> shuttle_serenity::ShuttleSerenity {
// Get the discord token set in `Secrets.toml`
let discord_token = secret_store
Expand Down
4 changes: 2 additions & 2 deletions templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ tags = ["actix-web", "tracing"]

[examples.metadata]
title = "Shuttle Metadata"
description = "Basic usage of shuttle-metadata"
description = "Basic usage of Shuttle Metadata"
path = "axum/metadata"
use_cases = []
tags = ["axum"]
Expand All @@ -329,7 +329,7 @@ tags = ["rocket"]

[examples.secrets]
title = "Shuttle Secrets"
description = "Basic usage of shuttle-secrets"
description = "Basic usage of Shuttle Secrets"
path = "rocket/secrets"
use_cases = ["Web app"]
tags = ["rocket"]
Expand Down

0 comments on commit e44b174

Please sign in to comment.