Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
Migration to Shuttle
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Dec 15, 2023
1 parent 0730fc0 commit 6b54a83
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 73 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/docker.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/fly.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/shuttle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Shuttle

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: shuttle-hq/deploy-action@main
with:
deploy-key: ${{ secrets.SHUTTLE_API_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ FodyWeavers.xsd

.env*
!.env.example
Secrets.toml

*.sql
!migrations/**/*.sql
Expand Down
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ awc = {version = "3.2.0", features = ["openssl"]}
base64 = "0.21.5"
chrono = {version = "0.4", features = ["serde"]}
diesel = {version = "2", features = ["postgres", "r2d2", "uuid", "serde_json", "chrono"]}
dotenvy = "0.15"
env_logger = "0.10"
log = "0.4"
poac_api_utils = {path = "./poac_api_utils"}
Expand Down
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

File renamed without changes.
13 changes: 0 additions & 13 deletions fly.toml

This file was deleted.

15 changes: 11 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@ use std::env;
use actix_web::{middleware::Logger, web, web::ServiceConfig};
use diesel::r2d2::{ConnectionManager, Pool};
use diesel::PgConnection;
use dotenvy::dotenv;
use shuttle_actix_web::ShuttleActixWeb;
use shuttle_secrets::SecretStore;

#[shuttle_runtime::main]
async fn actix_web() -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
dotenv().ok();
async fn actix_web(
#[shuttle_secrets::Secrets] secret_store: SecretStore,
) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
// Set up secrets
let database_url = secret_store.get("DATABASE_URL").expect("DATABASE_URL must be set");
let gh_oauth_client_id = secret_store.get("GITHUB_OAUTH_CLIENT_ID").expect("GITHUB_OAUTH_CLIENT_ID must be set");
let gh_oauth_client_secret = secret_store.get("GITHUB_OAUTH_CLIENT_SECRET").expect("GITHUB_OAUTH_CLIENT_SECRET must be set");

env::set_var("GITHUB_OAUTH_CLIENT_ID", gh_oauth_client_id);
env::set_var("GITHUB_OAUTH_CLIENT_SECRET", gh_oauth_client_secret);

// Set up database connection pool
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let manager = ConnectionManager::<PgConnection>::new(database_url);
let pool = Pool::builder()
.build(manager)
Expand Down

0 comments on commit 6b54a83

Please sign in to comment.