Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update shuttle version in deployment generation #616

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DEPLOYMENT_SHUTTLE_T: &str = include_str!("templates/deployment_shuttle.t"
const DEPLOYMENT_SHUTTLE_CONFIG_T: &str = include_str!("templates/deployment_shuttle_config.t");
const DEPLOYMENT_NGINX_T: &str = include_str!("templates/deployment_nginx.t");

const DEPLOYMENT_SHUTTLE_RUNTIME_VERSION: &str = "0.38.0";
const DEPLOYMENT_SHUTTLE_RUNTIME_VERSION: &str = "0.46.0";

const DEPLOYMENT_OPTIONS: &[(&str, DeploymentKind)] = &[
("Docker", DeploymentKind::Docker),
Expand Down
8 changes: 4 additions & 4 deletions src/gen/templates/deployment_shuttle.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ injections:
after: \[dependencies\]
content: |
shuttle-axum = "{{shuttle_runtime_version}}"
shuttle-metadata = "{{shuttle_runtime_version}}"
shuttle-runtime = { version = "{{shuttle_runtime_version}}", default-features = false }
{% if with_db -%}
shuttle-shared-db = { version = "{{shuttle_runtime_version}}", features = ["postgres"] }
Expand All @@ -28,16 +27,17 @@ use loco_rs::boot::{create_app, StartMode};
use loco_rs::environment::Environment;
use {{pkg_name}}::app::App;
{% if with_db %}use migration::Migrator;{% endif %}
use shuttle_runtime::DeploymentMetadata;

#[shuttle_runtime::main]
async fn main(
{% if with_db %}#[shuttle_shared_db::Postgres] conn_str: String,{% endif %}
#[shuttle_metadata::ShuttleMetadata] meta: shuttle_metadata::Metadata,
#[shuttle_runtime::Metadata] meta: DeploymentMetadata,
) -> shuttle_axum::ShuttleAxum {
{% if with_db %}std::env::set_var("DATABASE_URL", conn_str);{% endif %}
let environment = match meta.env {
shuttle_metadata::Environment::Local => Environment::Development,
shuttle_metadata::Environment::Deployment => Environment::Production,
shuttle_runtime::Environment::Local => Environment::Development,
shuttle_runtime::Environment::Deployment => Environment::Production,
};
let boot_result = create_app::<App{% if with_db %}, Migrator{% endif %}>(StartMode::ServerOnly, &environment)
.await
Expand Down
Loading