From 87b15ff50721a5e70524510c2ac798ddade065c5 Mon Sep 17 00:00:00 2001 From: Darwin D Wu Date: Fri, 1 Nov 2024 23:53:11 -0700 Subject: [PATCH 1/2] Add workflow to verify convention commit --- .github/workflows/convention.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/convention.yml diff --git a/.github/workflows/convention.yml b/.github/workflows/convention.yml new file mode 100644 index 0000000..5027be9 --- /dev/null +++ b/.github/workflows/convention.yml @@ -0,0 +1,20 @@ +name: Convention Commit + +on: + pull_request: + +permissions: + pull-requests: read + statuses: write + +jobs: + lint: + name: Validate PR title + runs-on: ubuntu-latest + if: ${{ ! contains(github.head_ref, 'release/') }} + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + wip: true From 8413fa5aca95ba815b039fb77e474a10aaece19a Mon Sep 17 00:00:00 2001 From: Darwin D Wu Date: Sat, 2 Nov 2024 00:00:52 -0700 Subject: [PATCH 2/2] default to cloud mode following RFC --- deploy/kustomization.yaml | 1 - inngest/src/client.rs | 2 +- inngest/src/config.rs | 15 --------------- inngest/src/handler.rs | 9 ++++++++- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml index 8fc5ffc..da09f73 100644 --- a/deploy/kustomization.yaml +++ b/deploy/kustomization.yaml @@ -16,7 +16,6 @@ configMapGenerator: - INNGEST_SIGNING_KEY=REPLACE_SIGNING_KEY - INNGEST_EVENT_KEY=REPLACE_EVENT_KEY - - INNGEST_MODE=cloud resources: - namespace.yaml diff --git a/inngest/src/client.rs b/inngest/src/client.rs index 2c43025..594ac3c 100644 --- a/inngest/src/client.rs +++ b/inngest/src/client.rs @@ -23,7 +23,7 @@ pub struct Inngest { pub(crate) event_api_origin: Option, pub(crate) event_key: Option, pub(crate) env: Option, - dev: Option, + pub(crate) dev: Option, http: reqwest::Client, } diff --git a/inngest/src/config.rs b/inngest/src/config.rs index cae0f78..f657622 100644 --- a/inngest/src/config.rs +++ b/inngest/src/config.rs @@ -1,7 +1,5 @@ use std::env; -use crate::handler::Kind; - // client side const INNGEST_API_ORIGIN: &str = "INNGEST_API_ORIGIN"; const INNGEST_EVENT_API_ORIGIN: &str = "INNGEST_EVENT_API_ORIGIN"; @@ -14,9 +12,6 @@ const INNGEST_SIGNING_KEY: &str = "INNGEST_SIGNING_KEY"; const INNGEST_SERVE_ORIGIN: &str = "INNGEST_SERVE_ORIGIN"; const INNGEST_SERVE_PATH: &str = "INNGEST_SERVE_PATH"; -// optional -const INNGEST_MODE: &str = "INNGEST_MODE"; - pub(crate) struct Config {} impl Config { @@ -52,16 +47,6 @@ impl Config { Self::read_env_str(INNGEST_SERVE_PATH) } - pub fn mode() -> Kind { - match Self::read_env_str(INNGEST_MODE) { - None => Kind::Dev, - Some(v) => match v.to_lowercase().as_str() { - "cloud" => Kind::Cloud, - _ => Kind::Dev, - }, - } - } - // helper methods fn read_env_str(key: &str) -> Option { match env::var(key) { diff --git a/inngest/src/handler.rs b/inngest/src/handler.rs index 34ba957..5cad24d 100644 --- a/inngest/src/handler.rs +++ b/inngest/src/handler.rs @@ -46,7 +46,14 @@ impl Handler { let signing_key = Config::signing_key(); let serve_origin = Config::serve_origin(); let serve_path = Config::serve_path(); - let mode = Config::mode(); + let mode = match client.dev.clone() { + None => Kind::Cloud, + Some(v) => if v != "0" { + Kind::Dev + } else { + Kind::Cloud + } + }; Handler { signing_key,