-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom shuttle binary filename (#99)
- Loading branch information
Showing
4 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# Standalone binary - run an app with Shuttle or standalone | ||
|
||
This example shows how to separate a project's Shuttle logic from its core functionality so that two binaries can be made: one running with Shuttle using `cargo shuttle run` that can be deployed to Shuttle, and one that can be run with `cargo run --bin ...`. | ||
This example shows how to separate a project's Shuttle logic from its core functionality so that two binaries can be made: one for running with `cargo shuttle run` and deploying to Shuttle, and one that can be run with `cargo run --bin ...`. | ||
|
||
The main idea is to have a main binary that Shuttle runs, and another binary that runs standalone. | ||
All startup logic is placed in the binary source files, while the implementation (endpoints etc) is moved to the library of the crate. | ||
|
||
- `src/main.rs` is the main binary with Shuttle, run with `cargo shuttle run` | ||
- `src/standalone.rs` is without Shuttle, run with `cargo run --bin standalone` (you can change the name) | ||
- `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, 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. |
File renamed without changes.
File renamed without changes.