Skip to content
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
10 changes: 5 additions & 5 deletions cmd/e2e/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"net/http"
"time"

"github.com/google/uuid"
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
"github.com/hookdeck/outpost/internal/idgen"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func (suite *basicSuite) TestConsecutiveFailuresAlert() {
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()
secret := "testsecret1234567890abcdefghijklmnop"

tests := []APITest{
Expand Down Expand Up @@ -136,8 +136,8 @@ func (suite *basicSuite) TestConsecutiveFailuresAlert() {
}

func (suite *basicSuite) TestConsecutiveFailuresAlertReset() {
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()
secret := "testsecret1234567890abcdefghijklmnop"

// Setup phase - same as before
Expand Down
24 changes: 12 additions & 12 deletions cmd/e2e/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package e2e_test
import (
"net/http"

"github.com/google/uuid"
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
"github.com/hookdeck/outpost/internal/idgen"
)

func (suite *basicSuite) TestHealthzAPI() {
Expand All @@ -26,8 +26,8 @@ func (suite *basicSuite) TestHealthzAPI() {
}

func (suite *basicSuite) TestTenantsAPI() {
tenantID := uuid.New().String()
sampleDestinationID := uuid.New().String()
tenantID := idgen.String()
sampleDestinationID := idgen.Destination()
tests := []APITest{
{
Name: "GET /:tenantID without auth header",
Expand Down Expand Up @@ -272,8 +272,8 @@ func (suite *basicSuite) TestTenantsAPI() {
}

func (suite *basicSuite) TestDestinationsAPI() {
tenantID := uuid.New().String()
sampleDestinationID := uuid.New().String()
tenantID := idgen.String()
sampleDestinationID := idgen.Destination()
tests := []APITest{
{
Name: "PUT /:tenantID",
Expand Down Expand Up @@ -582,7 +582,7 @@ func (suite *basicSuite) TestDestinationsAPI() {
Name: "DELETE /:tenantID/destinations/:destinationID with invalid destination ID",
Request: suite.AuthRequest(httpclient.Request{
Method: httpclient.MethodDELETE,
Path: "/" + tenantID + "/destinations/" + uuid.New().String(),
Path: "/" + tenantID + "/destinations/" + idgen.Destination(),
}),
Expected: APITestExpectation{
Match: &httpclient.Response{
Expand Down Expand Up @@ -629,7 +629,7 @@ func (suite *basicSuite) TestDestinationsAPI() {
}

func (suite *basicSuite) TestDestinationsListAPI() {
tenantID := uuid.New().String()
tenantID := idgen.String()
tests := []APITest{
{
Name: "PUT /:tenantID",
Expand Down Expand Up @@ -795,8 +795,8 @@ func (suite *basicSuite) TestDestinationsListAPI() {
}

func (suite *basicSuite) TestDestinationEnableDisableAPI() {
tenantID := uuid.New().String()
sampleDestinationID := uuid.New().String()
tenantID := idgen.String()
sampleDestinationID := idgen.Destination()
tests := []APITest{
{
Name: "PUT /:tenantID",
Expand Down Expand Up @@ -1046,8 +1046,8 @@ func (suite *basicSuite) TestDestinationTypesAPI() {

func (suite *basicSuite) TestJWTAuthAPI() {
// Step 1: Create tenant and get JWT token
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()

// Create tenant first using admin auth
createTenantTests := []APITest{
Expand Down Expand Up @@ -1212,7 +1212,7 @@ func (suite *basicSuite) TestJWTAuthAPI() {
Name: "GET /wrong-tenant-id with JWT should fail",
Request: suite.AuthJWTRequest(httpclient.Request{
Method: httpclient.MethodGET,
Path: "/" + uuid.New().String(),
Path: "/" + idgen.String(),
}, token),
Expected: APITestExpectation{
Match: &httpclient.Response{
Expand Down
8 changes: 4 additions & 4 deletions cmd/e2e/configs/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

"github.com/google/uuid"
"github.com/hookdeck/outpost/internal/config"
"github.com/hookdeck/outpost/internal/idgen"
"github.com/hookdeck/outpost/internal/infra"
"github.com/hookdeck/outpost/internal/redis"
"github.com/hookdeck/outpost/internal/util/testinfra"
Expand Down Expand Up @@ -72,9 +72,9 @@ func Basic(t *testing.T, opts BasicOpts) config.Config {

// MQ overrides
c.MQs.RabbitMQ.ServerURL = rabbitmqServerURL
c.MQs.RabbitMQ.Exchange = uuid.New().String()
c.MQs.RabbitMQ.DeliveryQueue = uuid.New().String()
c.MQs.RabbitMQ.LogQueue = uuid.New().String()
c.MQs.RabbitMQ.Exchange = idgen.String()
c.MQs.RabbitMQ.DeliveryQueue = idgen.String()
c.MQs.RabbitMQ.LogQueue = idgen.String()

// Test-specific overrides
c.PublishMaxConcurrency = 3
Expand Down
26 changes: 13 additions & 13 deletions cmd/e2e/destwebhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"
"time"

"github.com/google/uuid"
"github.com/hookdeck/outpost/cmd/e2e/httpclient"
"github.com/hookdeck/outpost/internal/idgen"
)

// TestingT is an interface wrapper around *testing.T
Expand All @@ -15,13 +15,13 @@ type TestingT interface {
}

func (suite *basicSuite) TestDestwebhookPublish() {
tenantID := uuid.New().String()
sampleDestinationID := uuid.New().String()
tenantID := idgen.String()
sampleDestinationID := idgen.Destination()
eventIDs := []string{
uuid.New().String(),
uuid.New().String(),
uuid.New().String(),
uuid.New().String(),
idgen.Event(),
idgen.Event(),
idgen.Event(),
idgen.Event(),
}
secret := "testsecret1234567890abcdefghijklmnop"
newSecret := "testsecret0987654321zyxwvutsrqponm"
Expand Down Expand Up @@ -397,8 +397,8 @@ func (suite *basicSuite) TestDestwebhookPublish() {
}

func (suite *basicSuite) TestDestwebhookSecretRotation() {
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()

// Setup tenant
resp, err := suite.client.Do(suite.AuthRequest(httpclient.Request{
Expand Down Expand Up @@ -473,8 +473,8 @@ func (suite *basicSuite) TestDestwebhookSecretRotation() {
}

func (suite *basicSuite) TestDestwebhookTenantSecretManagement() {
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()

// First create tenant and get JWT token
createTenantTests := []APITest{
Expand Down Expand Up @@ -728,8 +728,8 @@ func (suite *basicSuite) TestDestwebhookTenantSecretManagement() {
}

func (suite *basicSuite) TestDestwebhookAdminSecretManagement() {
tenantID := uuid.New().String()
destinationID := uuid.New().String()
tenantID := idgen.String()
destinationID := idgen.Destination()
secret := "testsecret1234567890abcdefghijklmnop"
newSecret := "testsecret0987654321zyxwvutsrqponm"

Expand Down
22 changes: 22 additions & 0 deletions docs/pages/references/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ Global configurations are provided through env variables or a YAML file. ConfigM
| `GCP_PUBSUB_SERVICE_ACCOUNT_CREDENTIALS` | JSON string or path to a file containing GCP service account credentials for Pub/Sub. Required if GCP Pub/Sub is the chosen MQ provider and not running in an environment with implicit credentials (e.g., GCE, GKE). | `nil` | Conditional |
| `GIN_MODE` | Sets the Gin framework mode (e.g., 'debug', 'release', 'test'). See Gin documentation for details. | `release` | No |
| `HTTP_USER_AGENT` | Custom HTTP User-Agent string for outgoing webhook deliveries. If unset, a default (OrganizationName/Version) is used. | `nil` | No |
| `IDGEN_DELIVERY_EVENT_PREFIX` | Prefix for delivery event IDs, prepended with underscore (e.g., 'dev_123'). Default: empty (no prefix) | `nil` | No |
| `IDGEN_DELIVERY_PREFIX` | Prefix for delivery IDs, prepended with underscore (e.g., 'dlv_123'). Default: empty (no prefix) | `nil` | No |
| `IDGEN_DESTINATION_PREFIX` | Prefix for destination IDs, prepended with underscore (e.g., 'dst_123'). Default: empty (no prefix) | `nil` | No |
| `IDGEN_EVENT_PREFIX` | Prefix for event IDs, prepended with underscore (e.g., 'evt_123'). Default: empty (no prefix) | `nil` | No |
| `IDGEN_TYPE` | ID generation type for all entities: uuidv4, uuidv7, nanoid. Default: uuidv4 | `uuidv4` | No |
| `LOG_BATCH_SIZE` | Maximum number of log entries to batch together before writing to storage. | `1000` | No |
| `LOG_BATCH_THRESHOLD_SECONDS` | Maximum time in seconds to buffer logs before flushing them to storage, if batch size is not reached. | `10` | No |
| `LOG_LEVEL` | Defines the verbosity of application logs. Common values: 'trace', 'debug', 'info', 'warn', 'error'. | `info` | No |
Expand Down Expand Up @@ -227,6 +232,23 @@ gin_mode: "release"
# Custom HTTP User-Agent string for outgoing webhook deliveries. If unset, a default (OrganizationName/Version) is used.
http_user_agent: ""

idgen:
# Prefix for delivery event IDs, prepended with underscore (e.g., 'dev_123'). Default: empty (no prefix)
delivery_event_prefix: ""

# Prefix for delivery IDs, prepended with underscore (e.g., 'dlv_123'). Default: empty (no prefix)
delivery_prefix: ""

# Prefix for destination IDs, prepended with underscore (e.g., 'dst_123'). Default: empty (no prefix)
destination_prefix: ""

# Prefix for event IDs, prepended with underscore (e.g., 'evt_123'). Default: empty (no prefix)
event_prefix: ""

# ID generation type for all entities: uuidv4, uuidv7, nanoid. Default: uuidv4
type: "uuidv4"


# Maximum number of log entries to batch together before writing to storage.
log_batch_size: 1000

Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ require (
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/hookdeck/outpost/sdks/outpost-go v0.4.0
github.com/jackc/pgx/v5 v5.7.2
github.com/jackc/pgx/v5 v5.7.6
github.com/jmespath/go-jmespath v0.4.0
github.com/joho/godotenv v1.5.1
github.com/matoous/go-nanoid/v2 v2.1.0
github.com/mikestefanello/batcher v0.1.0
github.com/pkg/errors v0.9.1
github.com/rabbitmq/amqp091-go v1.10.0
Expand Down Expand Up @@ -72,7 +73,7 @@ require (
gocloud.dev v0.39.0
gocloud.dev/pubsub/rabbitpubsub v0.39.0
golang.org/x/oauth2 v0.22.0
golang.org/x/sync v0.11.0
golang.org/x/sync v0.13.0
google.golang.org/api v0.191.0
google.golang.org/grpc v1.65.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -216,12 +217,12 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.36.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect
Expand Down
26 changes: 14 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI=
github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk=
github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down Expand Up @@ -1119,6 +1119,8 @@ github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuz
github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
Expand Down Expand Up @@ -1404,8 +1406,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1584,8 +1586,8 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1676,8 +1678,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
Expand All @@ -1689,8 +1691,8 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1709,8 +1711,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
19 changes: 19 additions & 0 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/hookdeck/outpost/internal/config"
"github.com/hookdeck/outpost/internal/idgen"
"github.com/hookdeck/outpost/internal/infra"
"github.com/hookdeck/outpost/internal/logging"
"github.com/hookdeck/outpost/internal/migrator"
Expand Down Expand Up @@ -56,6 +57,24 @@ func run(mainContext context.Context, cfg *config.Config) error {
}
logger.Info("starting outpost", logFields...)

// Initialize ID generators
logger.Debug("configuring ID generators",
zap.String("type", cfg.IDGen.Type),
zap.String("event_prefix", cfg.IDGen.EventPrefix),
zap.String("destination_prefix", cfg.IDGen.DestinationPrefix),
zap.String("delivery_prefix", cfg.IDGen.DeliveryPrefix),
zap.String("delivery_event_prefix", cfg.IDGen.DeliveryEventPrefix))
if err := idgen.Configure(idgen.IDGenConfig{
Type: cfg.IDGen.Type,
EventPrefix: cfg.IDGen.EventPrefix,
DestinationPrefix: cfg.IDGen.DestinationPrefix,
DeliveryPrefix: cfg.IDGen.DeliveryPrefix,
DeliveryEventPrefix: cfg.IDGen.DeliveryEventPrefix,
}); err != nil {
logger.Error("failed to configure ID generators", zap.Error(err))
return err
}

if err := runMigration(mainContext, cfg, logger); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/app/installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"context"

"github.com/google/uuid"
"github.com/hookdeck/outpost/internal/idgen"
"github.com/hookdeck/outpost/internal/redis"
"github.com/hookdeck/outpost/internal/telemetry"
)
Expand Down Expand Up @@ -31,7 +31,7 @@ func getInstallation(ctx context.Context, redisClient redis.Cmdable, telemetryCo
}

// Installation ID doesn't exist, create one atomically
newInstallationID := uuid.New().String()
newInstallationID := idgen.Installation()

// Use HSETNX to atomically set the installation ID only if it doesn't exist
// This prevents race conditions when multiple Outpost instances start simultaneously
Expand Down
Loading
Loading