Skip to content

Commit be7b731

Browse files
authored
feat(cargo-shuttle): v0.48.2, colored platform outputs, fixes (#1886)
* feat: colored platform outputs * chore: unhide beta commands * nits * fix: beta deprecate clean command * fix(cargo-shuttle): don't validate api key, beta login url * fix: mentions of cargo shuttle * chore: bump cargo-shuttle * fix: show project id when deleting * tracing log
1 parent d01466e commit be7b731

File tree

16 files changed

+110
-115
lines changed

16 files changed

+110
-115
lines changed

.github/ISSUE_TEMPLATE/BUG-REPORT.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body:
1919
id: version
2020
attributes:
2121
label: Version
22-
description: What version of `cargo-shuttle` are you running (`cargo shuttle --version`)?
22+
description: What version of `cargo-shuttle` are you running (`shuttle --version`)?
2323
placeholder: "v0.48.0"
2424
validations:
2525
required: true

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,20 @@ iwr "https://www.shuttle.rs/install-win" | iex
9191
After installing, log in with:
9292

9393
```sh
94-
cargo shuttle login
94+
shuttle login
9595
```
9696

9797
To initialize your project, simply write:
9898

9999
```bash
100-
cargo shuttle init --template axum hello-world
100+
shuttle init --template axum hello-world
101101
```
102102

103103
And to deploy it, write:
104104

105105
```bash
106106
cd hello-world
107-
cargo shuttle project start # Only needed if project has not already been created during init
108-
cargo shuttle deploy --allow-dirty
107+
shuttle deploy
109108
```
110109

111110
And... that's it!
@@ -163,7 +162,7 @@ async fn main() -> shuttle_axum::ShuttleAxum {
163162
}
164163
```
165164

166-
Now, with just `cargo shuttle deploy`, you can see your application live. But let's enhance it further by adding a shared Postgres database:
165+
Now, with just `shuttle deploy`, you can see your application live. But let's enhance it further by adding a shared Postgres database:
167166

168167
```rust
169168
use axum::{routing::get, Router};
@@ -187,7 +186,7 @@ async fn main(
187186
}
188187
```
189188

190-
Now, if we run `cargo shuttle deploy`, we'll have an up and running project with a database inside & ready to use.
189+
Now, if we run `shuttle deploy`, we'll have an up and running project with a database inside & ready to use.
191190
<br>
192191
<br>
193192

cargo-shuttle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-shuttle"
3-
version = "0.48.1"
3+
version = "0.48.2"
44
edition.workspace = true
55
license.workspace = true
66
repository.workspace = true

cargo-shuttle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cargo install cargo-shuttle
4444

4545
## Documentation
4646

47-
Run `cargo shuttle help` to see the basic usage.
47+
Run `shuttle help` to see the basic usage.
4848

4949
Full list of commands and more documentation can be viewed on the [CLI docs](https://docs.shuttle.rs/getting-started/shuttle-commands).
5050

cargo-shuttle/src/args.rs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ use shuttle_common::resource;
2828
pub struct ShuttleArgs {
2929
#[command(flatten)]
3030
pub project_args: ProjectArgs,
31-
/// Run this command against the API at the supplied URL
32-
/// (allows targeting a custom deployed instance for this command only, mainly for development)
31+
/// URL for the Shuttle API to target (mainly for development)
3332
#[arg(global = true, long, env = "SHUTTLE_API")]
3433
pub api_url: Option<String>,
3534
/// Disable network requests that are not strictly necessary. Limits some features.
@@ -46,7 +45,7 @@ pub struct ShuttleArgs {
4645
pub cmd: Command,
4746
}
4847

49-
// Common args for subcommands that deal with projects.
48+
/// Global args for subcommands that deal with projects
5049
#[derive(Parser, Clone, Debug)]
5150
pub struct ProjectArgs {
5251
/// Specify the working directory
@@ -102,34 +101,34 @@ impl ProjectArgs {
102101
pub enum Command {
103102
/// Generate a Shuttle project from a template
104103
Init(InitArgs),
105-
/// Run a Shuttle service locally
104+
/// Run a project locally
106105
Run(RunArgs),
107-
/// Deploy a Shuttle service
106+
/// Deploy a project
108107
Deploy(DeployArgs),
109-
/// Manage deployments of a Shuttle service
108+
/// Manage deployments
110109
#[command(subcommand, visible_alias = "depl")]
111110
Deployment(DeploymentCommand),
112111
/// View the status of a Shuttle service
113112
Status,
114113
/// Stop a Shuttle service
115114
Stop,
116-
/// View logs of a Shuttle service
115+
/// View build and deployment logs
117116
Logs(LogsArgs),
118-
/// Manage projects on Shuttle
117+
/// Manage Shuttle projects
119118
#[command(subcommand, visible_alias = "proj")]
120119
Project(ProjectCommand),
121120
/// Manage resources
122121
#[command(subcommand, visible_alias = "res")]
123122
Resource(ResourceCommand),
124-
/// BETA: Manage SSL certificates for custom domains
125-
#[command(subcommand, visible_alias = "cert", hide = true)]
123+
/// Manage SSL certificates for custom domains
124+
#[command(subcommand, visible_alias = "cert")]
126125
Certificate(CertificateCommand),
127126
/// Remove cargo build artifacts in the Shuttle environment
128127
Clean,
129-
/// BETA: Show info about your Shuttle account
130-
#[command(visible_alias = "acc", hide = true)]
128+
/// Show info about your Shuttle account
129+
#[command(visible_alias = "acc")]
131130
Account,
132-
/// Login to the Shuttle platform
131+
/// Log in to the Shuttle platform
133132
Login(LoginArgs),
134133
/// Log out of the Shuttle platform
135134
Logout(LogoutArgs),
@@ -162,8 +161,8 @@ pub enum GenerateCommand {
162161

163162
#[derive(Parser)]
164163
pub struct TableArgs {
165-
#[arg(long, default_value_t = false)]
166164
/// Output tables without borders
165+
#[arg(long, default_value_t = false)]
167166
pub raw: bool,
168167
}
169168

@@ -172,12 +171,12 @@ pub enum DeploymentCommand {
172171
/// List the deployments for a service
173172
#[command(visible_alias = "ls")]
174173
List {
175-
#[arg(long, default_value = "1")]
176174
/// Which page to display
175+
#[arg(long, default_value = "1")]
177176
page: u32,
178177

179-
#[arg(long, default_value = "10", visible_alias = "per-page")]
180178
/// How many deployments per page to display
179+
#[arg(long, default_value = "10", visible_alias = "per-page")]
181180
limit: u32,
182181

183182
#[command(flatten)]
@@ -188,8 +187,7 @@ pub enum DeploymentCommand {
188187
/// ID of deployment to get status for
189188
id: Option<String>,
190189
},
191-
/// BETA: Stop running deployment(s)
192-
#[command(hide = true)]
190+
/// Stop running deployment(s)
193191
Stop,
194192
}
195193

@@ -201,8 +199,8 @@ pub enum ResourceCommand {
201199
#[command(flatten)]
202200
table: TableArgs,
203201

204-
#[arg(long, default_value_t = false)]
205202
/// Show secrets from resources (e.g. a password in a connection string)
203+
#[arg(long, default_value_t = false)]
206204
show_secrets: bool,
207205
},
208206
/// Delete a resource
@@ -247,9 +245,9 @@ pub enum ProjectCommand {
247245
Start(ProjectStartArgs),
248246
/// Check the status of this project's environment on Shuttle
249247
Status {
250-
#[arg(short, long)]
251248
/// Follow status of project
252249
// unused in beta (project has no state to follow)
250+
#[arg(short, long)]
253251
follow: bool,
254252
},
255253
/// Destroy this project's environment (container) on Shuttle
@@ -277,8 +275,8 @@ pub enum ProjectCommand {
277275

278276
#[derive(Parser, Debug)]
279277
pub struct ConfirmationArgs {
280-
#[arg(long, short, default_value_t = false)]
281278
/// Skip confirmations and proceed
279+
#[arg(long, short, default_value_t = false)]
282280
pub yes: bool,
283281
}
284282

@@ -306,11 +304,11 @@ pub struct LogoutArgs {
306304

307305
#[derive(Parser, Default)]
308306
pub struct DeployArgs {
309-
/// BETA: Deploy this Docker image instead of building one
307+
/// WIP: Deploy this Docker image instead of building one
310308
#[arg(long, short = 'i', hide = true)]
311-
pub image: Option<String>, // TODO?: Make this a subcommand instead? `cargo shuttle deploy image ...`
312-
/// BETA: Don't follow the deployment status, exit after the deployment begins
313-
#[arg(long, visible_alias = "nf", hide = true)]
309+
pub image: Option<String>, // TODO?: Make this a subcommand instead? `shuttle deploy image ...`
310+
/// Don't follow the deployment status, exit after the deployment begins
311+
#[arg(long, visible_alias = "nf")]
314312
pub no_follow: bool,
315313

316314
/// Allow deployment with uncommitted files

cargo-shuttle/src/config.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55
use anyhow::{anyhow, Context, Result};
66
use serde::{Deserialize, Serialize};
77
use shuttle_common::constants::API_URL_BETA;
8-
use shuttle_common::{constants::API_URL_DEFAULT, ApiKey};
8+
use shuttle_common::constants::API_URL_DEFAULT;
99
use tracing::trace;
1010

1111
use crate::args::ProjectArgs;
@@ -128,12 +128,12 @@ pub struct GlobalConfig {
128128
}
129129

130130
impl GlobalConfig {
131-
pub fn api_key(&self) -> Option<Result<ApiKey>> {
132-
self.api_key.as_ref().map(|key| ApiKey::parse(key))
131+
pub fn api_key(&self) -> Option<String> {
132+
self.api_key.clone()
133133
}
134134

135-
pub fn set_api_key(&mut self, api_key: ApiKey) -> Option<String> {
136-
self.api_key.replace(api_key.as_ref().to_string())
135+
pub fn set_api_key(&mut self, api_key: String) -> Option<String> {
136+
self.api_key.replace(api_key)
137137
}
138138

139139
pub fn clear_api_key(&mut self) {
@@ -432,22 +432,19 @@ impl RequestContext {
432432
/// Get the API key from the `SHUTTLE_API_KEY` env variable, or
433433
/// otherwise from the global configuration. Returns an error if
434434
/// an API key is not set.
435-
pub fn api_key(&self) -> Result<ApiKey> {
436-
let api_key = std::env::var("SHUTTLE_API_KEY");
437-
438-
if let Ok(key) = api_key {
439-
ApiKey::parse(&key).context("environment variable SHUTTLE_API_KEY is invalid")
440-
} else {
441-
match self.global.as_ref().unwrap().api_key() {
442-
Some(key) => key,
435+
pub fn api_key(&self) -> Result<String> {
436+
match std::env::var("SHUTTLE_API_KEY") {
437+
Ok(key) => Ok(key),
438+
Err(_) => match self.global.as_ref().unwrap().api_key() {
439+
Some(key) => Ok(key),
443440
None => Err(anyhow!(
444441
"Configuration file: `{}`",
445442
self.global.manager.path().display()
446443
)
447444
.context(anyhow!(
448-
"No valid API key found, try logging in first with:\n\tcargo shuttle login"
445+
"No valid API key found, try logging in first with `shuttle login`"
449446
))),
450-
}
447+
},
451448
}
452449
}
453450

@@ -465,7 +462,7 @@ impl RequestContext {
465462
}
466463

467464
/// Set the API key to the global configuration. Will persist the file.
468-
pub fn set_api_key(&mut self, api_key: ApiKey) -> Result<()> {
465+
pub fn set_api_key(&mut self, api_key: String) -> Result<()> {
469466
self.global.as_mut().unwrap().set_api_key(api_key);
470467
self.global.save()
471468
}

0 commit comments

Comments
 (0)