summaryrefslogtreecommitdiff
path: root/src/handlers/ships.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-07-10 11:05:51 -0400
committerCara Salter <cara@devcara.com>2022-07-10 11:05:51 -0400
commitd3279088e3a816db2c254b957159d5b697dc0f62 (patch)
tree764557ef69bdff984faad4885c8e00d6c9546107 /src/handlers/ships.rs
parent131dd5ab9df295b0bad320675b2307afcbf7d076 (diff)
downloadhomeworld-d3279088e3a816db2c254b957159d5b697dc0f62.tar.gz
homeworld-d3279088e3a816db2c254b957159d5b697dc0f62.zip
colonies: Fully support {meta, user}-data
cloud-init should be able to use this as a seed to properly set up the Planet.
Diffstat (limited to 'src/handlers/ships.rs')
-rw-r--r--src/handlers/ships.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/handlers/ships.rs b/src/handlers/ships.rs
index 91944fc..3101e54 100644
--- a/src/handlers/ships.rs
+++ b/src/handlers/ships.rs
@@ -8,7 +8,7 @@ use sqlx::{query, query_as, Error as SqlxError};
use tracing::log::warn;
use crate::{
- errors::{JsonResult, ServiceError, StringResult},
+ errors::{JsonResult, ServiceError, StringResult, StrResult},
State,
};
@@ -31,7 +31,7 @@ pub async fn new(
Json(new_ship): Json<Ship>,
state: Extension<Arc<State>>,
AuthBearer(token): AuthBearer,
-) -> StringResult {
+) -> StrResult {
check_bearer(token)?;
let mut conn = state.conn.acquire().await?;
@@ -52,7 +52,7 @@ pub async fn delete(
Path(shasum): Path<Sha256>,
state: Extension<Arc<State>>,
AuthBearer(token): AuthBearer,
-) -> StringResult {
+) -> StrResult {
check_bearer(token)?;
let mut conn = state.conn.acquire().await?;
@@ -89,7 +89,7 @@ pub async fn get(
Ok(Json(db_ship))
}
-fn check_bearer(token: String) -> Result<(), ServiceError> {
+pub fn check_bearer(token: String) -> Result<(), ServiceError> {
let expected_token = match std::env::var("SHARED_KEY") {
Ok(t) => t,
Err(_) => {