Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in-band sync capability #56

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions consts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package inngestgo

const (
SDKAuthor = "inngest"
SDKLanguage = "go"
SDKVersion = "0.7.3"

SyncKindInBand = "in_band"
SyncKindOutOfBand = "out_of_band"
)
26 changes: 24 additions & 2 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package inngestgo
import (
"net/url"
"os"
"strings"
)

const (
devServerURL = "http://127.0.0.1:8288"

envKeyAllowInBandSync = "INNGEST_ALLOW_IN_BAND_SYNC"
)

// IsDev returns whether to use the dev server, by checking the presence of the INNGEST_DEV
Expand All @@ -15,8 +18,8 @@ const (
// To use the dev server, set INNGEST_DEV to any non-empty value OR the URL of the development
// server, eg:
//
// INNGEST_DEV=1
// INNGEST_DEV=http://192.168.1.254:8288
// INNGEST_DEV=1
// INNGEST_DEV=http://192.168.1.254:8288
func IsDev() bool {
return os.Getenv("INNGEST_DEV") != ""
}
Expand All @@ -32,3 +35,22 @@ func DevServerURL() string {
}
return devServerURL
}

func allowInBandSync() bool {
val := os.Getenv(envKeyAllowInBandSync)
if val == "" {
// TODO: Default to true once in-band syncing is stable
return false
}

return isTruthy(val)
}

func isTruthy(val string) bool {
val = strings.ToLower(val)
if val == "false" || val == "0" || val == "" {
return false
}

return true
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.21.5
require (
github.com/gosimple/slug v1.12.0
github.com/gowebpki/jcs v1.0.0
github.com/inngest/inngest v0.30.0-beta-2.0.20240905105759-4df2bfd0dd29
github.com/inngest/inngest v0.30.0-beta-2.0.20240912142400-4c207d8fb0ce
github.com/stretchr/testify v1.9.0
github.com/xhit/go-str2duration/v2 v2.1.0
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inngest/expr v0.0.0-20240717151033-03e4378c436c h1:9XaJS0BV+5wYqv3pVh9OxowUPArRdGMRa8xFdV7eTAI=
github.com/inngest/expr v0.0.0-20240717151033-03e4378c436c/go.mod h1:Dq8dNC1Q/cZBjl6ltxCoAeNn8fstrBJWWjeSisqTL94=
github.com/inngest/inngest v0.30.0-beta-2.0.20240905105759-4df2bfd0dd29 h1:411jiRzzlz604f+76s+cFqCSMbCdT8J1uDbz4tMbhIM=
github.com/inngest/inngest v0.30.0-beta-2.0.20240905105759-4df2bfd0dd29/go.mod h1:AM/9t/guHM0r4oZFqXBWYyvMJABQ/fP3qkrxZOiFFLI=
github.com/inngest/inngest v0.30.0-beta-2.0.20240912142400-4c207d8fb0ce h1:E1EGAXuWyrH4lHrx0/BxBVpA7JEH2y27M0brtRLArNg=
github.com/inngest/inngest v0.30.0-beta-2.0.20240912142400-4c207d8fb0ce/go.mod h1:AM/9t/guHM0r4oZFqXBWYyvMJABQ/fP3qkrxZOiFFLI=
github.com/karlseguin/ccache/v2 v2.0.8 h1:lT38cE//uyf6KcFok0rlgXtGFBWxkI6h/qg4tbFyDnA=
github.com/karlseguin/ccache/v2 v2.0.8/go.mod h1:2BDThcfQMf/c0jnZowt16eW405XIqZPavt+HoYEtcxQ=
github.com/karlseguin/expect v1.0.2-0.20190806010014-778a5f0c6003 h1:vJ0Snvo+SLMY72r5J4sEfkuE7AFbixEP2qRbEcum/wA=
Expand Down
Loading
Loading