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

SDP-1116 Support External_ID DRAFT PR (See TODO). reece #256

Draft
wants to merge 49 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d6adff0
initial without sep24 claim verification
reecexlm Apr 12, 2024
2b7aa01
resolve conflicts
reecexlm Apr 16, 2024
6b24019
missed resolving 2 conflicts
reecexlm Apr 16, 2024
66b017d
updates to serveopts for multitenancy to support external-id
reecexlm Apr 16, 2024
99bb3c9
fix for tenant domain in unit test
reecexlm Apr 18, 2024
ee87c8b
draft of customer-id/hashed mobile# verification
reecexlm Apr 18, 2024
88245da
adding more tests
reecexlm Apr 19, 2024
b05dc79
Fix indentation and tests.
marcelosalloum Apr 19, 2024
09aeba1
Remove extra spaces.
marcelosalloum Apr 19, 2024
b90ae10
fix db cleanup in tests
reecexlm Apr 20, 2024
94f554d
fix conflicts
reecexlm Apr 20, 2024
75a9f94
test fixes
reecexlm Apr 20, 2024
ab60cac
remove rollback
reecexlm Apr 20, 2024
fe65c5e
fix
reecexlm Apr 20, 2024
a36577a
noop
reecexlm Apr 21, 2024
8148138
noop
reecexlm Apr 21, 2024
21eefee
noop
reecexlm Apr 21, 2024
b7f7e96
noop
reecexlm Apr 21, 2024
4fa13da
noop
reecexlm Apr 21, 2024
4c28c3d
noop
reecexlm Apr 21, 2024
0942120
noop
reecexlm Apr 21, 2024
5f00001
noop
reecexlm Apr 22, 2024
dc61fd8
noop
reecexlm Apr 23, 2024
ad5603f
Update internal/services/send_receiver_wallets_invite_service.go
reecexlm Apr 23, 2024
292015f
noop
reecexlm Apr 23, 2024
573de96
noop
marwen-abid Apr 23, 2024
f83d283
Fix lint issues and other errors.
marwen-abid Apr 23, 2024
20ae751
make `kafka-security-protocol` optional
marwen-abid Apr 23, 2024
fcb9827
noop
reecexlm Apr 24, 2024
eda7452
Merge branch 'sdp-1116-externalid' of https://github.com/stellar/stel…
reecexlm Apr 24, 2024
aab9010
noop
reecexlm Apr 24, 2024
37c3db1
noop
reecexlm Apr 25, 2024
f9ae6b0
do not crash if default tenant is missing
reecexlm Apr 26, 2024
7793716
do not error on missing tenant
reecexlm Apr 27, 2024
d8d0896
providing an informative error message
reecexlm Apr 27, 2024
2c47a3e
noop
reecexlm Apr 27, 2024
acc79af
noop
reecexlm Apr 27, 2024
3be5dc2
Add Postman Sample Collection
reecexlm Apr 27, 2024
6efdfec
noop
reecexlm Apr 30, 2024
b88185d
noop
reecexlm May 1, 2024
19ee8de
noop
reecexlm May 1, 2024
558eae4
debugging
reecexlm May 1, 2024
7d6c88e
debugging
reecexlm May 1, 2024
9495335
put middleware tenant check back
reecexlm May 9, 2024
91844b6
turn debug off
reecexlm May 9, 2024
cbae53c
try moving health to top of handleHTTP
reecexlm May 9, 2024
0a0f0ef
only warn on tenant missing
reecexlm May 9, 2024
a9c87f9
Merge branch 'develop' into sdp-1116-externalid
reecexlm May 31, 2024
3e6ef02
Merge branch 'develop' into sdp-1116-externalid
reecexlm Jul 20, 2024
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
33 changes: 33 additions & 0 deletions Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use the golang image for building and debugging
FROM golang:1.22.1-bullseye AS build
ARG GIT_COMMIT

# Set the working directory inside the Docker container
WORKDIR /app

# Copy the Go module files and download dependencies
COPY go.mod go.sum ./
RUN go mod download

# Copy the entire project directory from your host machine to the Docker container
COPY . ./github.com/stellar/stellar-disbursement-platform

# Build your application
WORKDIR /app/github.com/stellar/stellar-disbursement-platform
RUN go build -gcflags="all=-N -l" -o stellar-disbursement-platform

#install jq for automating tenant owners
RUN apt-get update && apt-get install -y jq

# Install Delve for debugging
RUN go install github.com/go-delve/delve/cmd/dlv@latest

# Ensure the binary has executable permissions
RUN chmod +x /app/github.com/stellar/stellar-disbursement-platform
RUN chmod +x /app/github.com/stellar/stellar-disbursement-platform/dev/scripts/add_test_users.sh

# Expose the ports for your application
EXPOSE 8001

# Set the entrypoint to start Delve in headless mode for debugging
ENTRYPOINT ["/go/bin/dlv", "exec", "./stellar-disbursement-platform", "serve", "--headless", "--listen=:2345", "--api-version=2", "--log"]
32 changes: 32 additions & 0 deletions Dockerfile.wip
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Stage 1: Build the Go application
FROM golang:1.22.1-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
ADD go.mod go.sum ./
RUN go mod download
ADD . ./
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .

# Stage 2: Setup the development environment with Delve for debugging
FROM golang:1.22.1-bullseye AS development

WORKDIR /app/github.com/stellar/stellar-disbursement-platform
# Copy the built executable and all source files for debugging
COPY --from=build /src/stellar-disbursement-platform /app/github.com/stellar/stellar-disbursement-platform
# Build a debug version of the binary
RUN go build -gcflags="all=-N -l" -o stellar-disbursement-platform .
# Install Delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Ensure the binary has executable permissions
RUN chmod +x /app/github.com/stellar/stellar-disbursement-platform/stellar-disbursement-platform
EXPOSE 8001 2345
ENTRYPOINT ["/go/bin/dlv", "debug", "./stellar-disbursement-platform", "serve", "--headless", "--listen=:2345", "--api-version=2", "--log"]

# Stage 3: Create a production image using Ubuntu
FROM ubuntu:22.04 AS production
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
COPY --from=build /bin/stellar-disbursement-platform /app/stellar-disbursement-platform
EXPOSE 8001
WORKDIR /app
ENTRYPOINT ["./stellar-disbursement-platform"]
32 changes: 32 additions & 0 deletions Dockerfile.wip2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Stage 1: Build the Go application
FROM golang:1.22.1-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
ADD go.mod go.sum ./
RUN go mod download
ADD . ./
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .

# Stage 2: Setup the development environment with Delve for debugging
FROM golang:1.22.1-bullseye AS development

WORKDIR /app/github.com/stellar/stellar-disbursement-platform
# Copy the built executable and all source files for debugging
COPY --from=build /src/stellar-disbursement-platform /app/github.com/stellar/stellar-disbursement-platform
# Build a debug version of the binary
RUN go build -gcflags="all=-N -l" -o stellar-disbursement-platform .
# Install Delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Ensure the binary has executable permissions
RUN chmod +x /app/github.com/stellar/stellar-disbursement-platform/stellar-disbursement-platform
EXPOSE 8001 2345
ENTRYPOINT ["/go/bin/dlv", "debug", "./stellar-disbursement-platform", "serve", "--headless", "--listen=:2345", "--api-version=2", "--log"]

# Stage 3: Create a production image using Ubuntu
FROM ubuntu:22.04 AS production
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
COPY --from=build /bin/stellar-disbursement-platform /app/stellar-disbursement-platform
EXPOSE 8001
WORKDIR /app
ENTRYPOINT ["./stellar-disbursement-platform"]
14 changes: 14 additions & 0 deletions cmd/serve.go
marcelosalloum marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@
MessengerClient: o.ServeOpts.SMSMessengerClient,
MaxInvitationSMSResendAttempts: int64(o.ServeOpts.MaxInvitationSMSResendAttempts),
Sep10SigningPrivateKey: o.ServeOpts.Sep10SigningPrivateKey,
<<<<<<< HEAD

Check failure on line 148 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / check

syntax error: unexpected <<, expected expression

Check failure on line 148 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / check

syntax error: unexpected <<, expected expression

Check failure on line 148 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / build

syntax error: unexpected <<, expected expression
CrashTrackerClient: o.ServeOpts.CrashTrackerClient.Clone(),

Check failure on line 149 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / check

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 149 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / build

syntax error: unexpected ) in composite literal; possibly missing comma or }
UseExternalID: o.ServeOpts.UseExternalID,

Check failure on line 150 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / check

syntax error: unexpected : in argument list; possibly missing comma or )

Check failure on line 150 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / build

syntax error: unexpected : in argument list; possibly missing comma or )
=======
>>>>>>> develop
}),

Check failure on line 153 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / check

syntax error: unexpected ) after top level declaration) (typecheck)

Check failure on line 153 in cmd/serve.go

View workflow job for this annotation

GitHub Actions / build

syntax error: unexpected ) after top level declaration
)
if err != nil {
return fmt.Errorf("creating SMS Invitation Kafka Consumer: %w", err)
Expand Down Expand Up @@ -341,6 +346,14 @@
FlagDefault: 3,
Required: true,
},
{
Name: "use-external-id",
Usage: "Enable or disable the use of external ID in wallet deep links",
OptType: types.Bool,
ConfigKey: &serveOpts.UseExternalID, // Ensure ServeOptions has a UseExternalID field of type bool
FlagDefault: false, // Default value set to false. Do Not embed external_id in wallet deep links
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Is you want to make this feature available for tests without changing anything in the dpeloyments, you can simply set the default to true:

Suggested change
FlagDefault: false, // Default value set to false. Do Not embed external_id in wallet deep links
FlagDefault: true, // Default value set to true so the feature is enabled in the PR preview. // TODO: default to false if merging it in the actual code.

Required: false,
},
{
Name: "single-tenant-mode",
Usage: "This option enables the Single Tenant Mode feature. In the case where multi-tenancy is not required, this options bypasses the tenant resolution by always resolving to the default tenant configured in the database.",
Expand Down Expand Up @@ -672,6 +685,7 @@

// Starting Application Server
log.Ctx(ctx).Info("Starting Application Server...")
fmt.Printf("Use External ID: %t\n", serveOpts.UseExternalID)
serverService.StartServe(serveOpts, &serve.HTTPServer{})
},
}
Expand Down
12 changes: 12 additions & 0 deletions compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
app:
entrypoint:
- sleep
- infinity
image: docker/dev-environments-go:stable-1
init: true
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock

14 changes: 14 additions & 0 deletions dev/.env.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generate a new keypair for SEP-10 signing
SEP10_SIGNING_PUBLIC_KEY=GBQGDASIDGI6SAOWXPJXJZSAKPP5W3IJYU2YN5B4O33W3MVWNMKT2BYZ
SEP10_SIGNING_PRIVATE_KEY=SAFAFP3M4PHXRYJD6J4EA33MVZWGUEMALFKVROCEFVV6J32X7LZBIBYG

# Generate a new keypair for the distribution account
DISTRIBUTION_PUBLIC_KEY=GCFOB7CATOKXZSUFI362MO6SRTJUWOCZWWMPF2LX3Q2Z5M5CHQ7JYKD2
DISTRIBUTION_SEED=SDOHYDJARUVAGQ2KO6KLIOAYGK4CCQ5RLWMUNLAOVXGS2FX6PHWBK3JO

# CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE
CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE=${DISTRIBUTION_SEED}

# Distribution signer
DISTRIBUTION_SIGNER_TYPE=DISTRIBUTION_ACCOUNT_ENV
DISTRIBUTION_ACCOUNT_ENCRYPTION_PASSPHRASE=${DISTRIBUTION_SEED}
1 change: 0 additions & 1 deletion dev/docker-compose-sdp-anchor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ services:
RECAPTCHA_SITE_SECRET_KEY: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
ANCHOR_PLATFORM_OUTGOING_JWT_SECRET: mySdpToAnchorPlatformSecret
entrypoint: "./dev/scripts/debug_entrypoint.sh"

db-anchor-platform:
container_name: anchor-platform-postgres-db-mtn
image: postgres:14-alpine
Expand Down
Loading
Loading