Skip to content

Commit f15e6bb

Browse files
authored
refactor: move secrets and metadata plugins to runtime (#1673)
* refactor: move secrets and metadata plugins to runtime * feat: impl config::Source for SecretStore * ci: skip crates * fix lock * Revert "feat: impl config::Source for SecretStore" This reverts commit 7442c24. * fix docs * fix: deprecation warnings * bump examples * fix * fix serenity * nit * bump examples * fix serenity * fix rocket doc test * bump examples * bump examples
1 parent b40a14b commit f15e6bb

File tree

28 files changed

+211
-326
lines changed

28 files changed

+211
-326
lines changed

.circleci/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,8 @@ workflows:
631631
parameters:
632632
path:
633633
- resources/aws-rds
634-
- resources/metadata
635634
- resources/persist
636635
- resources/qdrant
637-
- resources/secrets
638636
- resources/shared-db
639637
- resources/turso
640638
- resources/opendal

cargo-shuttle/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ impl Shuttle {
443443
} else {
444444
get_templates_schema()
445445
.await
446-
.map_err(|_| {
446+
.map_err(|e| {
447+
error!(err = %e, "Failed to get templates");
447448
println!(
448449
"{}",
449450
"Failed to look up template list. Falling back to internal list."

codegen/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod shuttle_main;
2626
/// | `ShuttlePoem` | [shuttle-poem](https://crates.io/crates/shuttle-poem) | [poem](https://docs.rs/poem/2.0) | 2.0 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/poem/hello-world) |
2727
/// | `ShuttleRocket` | [shuttle-rocket](https://crates.io/crates/shuttle-rocket) | [rocket](https://docs.rs/rocket/0.5) | 0.5 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/rocket/hello-world) |
2828
/// | `ShuttleSalvo` | [shuttle-salvo](https://crates.io/crates/shuttle-salvo) | [salvo](https://docs.rs/salvo/0.63) | 0.63 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/salvo/hello-world) |
29-
/// | `ShuttleSerenity` | [shuttle-serenity](https://crates.io/crates/shuttle-serenity | [serenity](https://docs.rs/serenity/0.12) and [poise](https://docs.rs/poise/0.6) | 0.12 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/serenity/hello-world) |
29+
/// | `ShuttleSerenity` | [shuttle-serenity](https://crates.io/crates/shuttle-serenity) | [serenity](https://docs.rs/serenity/0.12) and [poise](https://docs.rs/poise/0.6) | 0.12 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/serenity/hello-world) |
3030
/// | `ShuttleThruster` | [shuttle-thruster](https://crates.io/crates/shuttle-thruster) | [thruster](https://docs.rs/thruster/1.3) | 1.3 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/thruster/hello-world) |
3131
/// | `ShuttleTower` | [shuttle-tower](https://crates.io/crates/shuttle-tower) | [tower](https://docs.rs/tower/0.4) | 0.4 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/tower/hello-world) |
3232
/// | `ShuttleTide` | [shuttle-tide](https://crates.io/crates/shuttle-tide) | [tide](https://docs.rs/tide/0.16) | 0.16 | [GitHub](https://github.com/shuttle-hq/shuttle-examples/tree/main/tide/hello-world) |

common/src/resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ pub struct Response {
5656
/// The type of this resource.
5757
pub r#type: Type,
5858

59-
/// The config used when creating this resource. Use the [Self::r#type] to know how to parse this data.
59+
/// The config used when creating this resource. Use the `r#type` to know how to parse this data.
6060
pub config: Value,
6161

62-
/// The data associated with this resource. Use the [Self::r#type] to know how to parse this data.
62+
/// The data associated with this resource. Use the `r#type` to know how to parse this data.
6363
pub data: Value,
6464
}
6565

common/src/secrets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use zeroize::Zeroize;
44

55
/// Wrapper type for secret values such as passwords or authentication keys.
66
///
7-
/// Once wrapped, the inner value cannot leak accidentally, as both the [`Display`] and [`Debug`]
7+
/// Once wrapped, the inner value cannot leak accidentally, as both the [`std::fmt::Display`] and [`Debug`]
88
/// implementations cover up the actual value and only show the type.
99
///
1010
/// If you need access to the inner value, there is an [expose](`Secret::expose`) method.

examples

Submodule examples updated 50 files

resources/metadata/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ keywords = ["shuttle-service", "metadata"]
88

99
[dependencies]
1010
async-trait = "0.1.56"
11-
shuttle-service = { path = "../../service", version = "0.41.0" }
11+
shuttle-service = { path = "../../service", version = "<=0.44.0" }

resources/metadata/README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
11
# Shuttle Metadata
22

3-
This plugin allows applications to obtain certain information about their runtime environment.
4-
5-
## Usage
6-
7-
Add `shuttle-metadata` to the dependencies for your service.
8-
9-
You can get this resource using the `shuttle_metadata::ShuttleMetadata` attribute to get a `Metadata`. This struct will contain information such as the Shuttle service name.
10-
11-
```rust
12-
#[shuttle_runtime::main]
13-
async fn app(
14-
#[shuttle_metadata::ShuttleMetadata] metadata: shuttle_metadata::Metadata,
15-
) -> __ { ... }
16-
```
17-
18-
#### Example projects that use `shuttle-metadata`
19-
20-
| Framework | Link |
21-
| --------- | -------------------------------------------------------------------------------------- |
22-
| Axum | [axum example](https://github.com/shuttle-hq/shuttle-examples/tree/main/axum/metadata) |
3+
This plugin has been moved to [shuttle-runtime](https://crates.io/crates/shuttle-runtime).

resources/metadata/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ pub use shuttle_service::{DeploymentMetadata as Metadata, Environment, SecretSto
33
use shuttle_service::{Error, ResourceFactory, ResourceInputBuilder};
44

55
#[derive(Default)]
6+
#[deprecated(
7+
since = "0.42.0",
8+
note = "This plugin has been moved to shuttle_runtime::Metadata, see https://docs.shuttle.rs/resources/shuttle-metadata"
9+
)]
610
pub struct ShuttleMetadata;
711

812
#[async_trait]

resources/secrets/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ keywords = ["shuttle-service", "secrets"]
99
[dependencies]
1010
async-trait = "0.1.56"
1111
serde_json = "1"
12-
shuttle-service = { path = "../../service", version = "0.41.0" }
12+
shuttle-service = { path = "../../service", version = "<=0.44.0" }

0 commit comments

Comments
 (0)