Skip to content

Commit

Permalink
chore: add launch config for VSCode (#3239)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Apr 19, 2023
1 parent 6fe4dac commit a046778
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ heap_profiler/
goroutine_dump/
inflight_trace_dump/

.vscode

e2e/*.log
e2e/kratos.*.yml
e2e/proxy.json
Expand Down Expand Up @@ -62,3 +60,4 @@ test/e2e/kratos.*.yml

# VSCode debug artifact
__debug_bin
.debug.sqlite.db
34 changes: 34 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
// Launch configuration to build and launch Kratos
// It uses a barebones
"version": "0.2.0",
"configurations": [
{
"name": "Debug Kratos",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/main.go",
"buildFlags": "-tags sqlite",
"preLaunchTask": "Kratos: setup",
"postDebugTask": "close tasks", // stops mailhog. Needed, because VSCode does not re-use existing isBackground tasks
"args": [
"serve",
"--dev",
"--watch-courier",
"-c=${workspaceFolder}/contrib/quickstart/kratos/email-password/kratos.yml"
],
"internalConsoleOptions": "openOnSessionStart",
"env": {
"IDENTITY_SCHEMAS_0_URL": "file://${workspaceFolder}/contrib/quickstart/kratos/email-password/identity.schema.json",
"DSN": "sqlite://${workspaceFolder}/.debug.sqlite.db?_fk=true",
"COURIER_SMTP_CONNECTION_URI": "smtp://localhost:8026/?disable_starttls=true",
"DEV_DISABLE_API_FLOW_ENFORCEMENT": "true",
"SELFSERVICE_METHODS_PASSWORD_CONFIG_HAVEIBEENPWNED_ENABLED": "false", // disable locally, as the integration hangs requests, if internet is slow
"TRACING_PROVIDER": "jaeger",
"TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL": "http://127.0.0.1:5778/sampling",
"TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS": "127.0.0.1:6831"
}
}
]
}
85 changes: 85 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Kratos: build",
"type": "shell",
"command": "go",
"args": [
"build",
"-tags",
"sqlite",
"-o",
"${workspaceFolder}/kratos",
"${workspaceFolder}/main.go"
]
},
{
"label": "Kratos debug: setup sqlite",
"type": "shell",
"presentation": {
"echo": false,
"reveal": "always"
},
"dependsOn": ["Kratos: build"],
"command": "rm -f ${workspaceFolder}/.debug.sqlite.db && ${workspaceFolder}/kratos migrate sql up -e --yes",
"options": {
"env": {
"DSN": "sqlite://${workspaceFolder}/.debug.sqlite.db?_fk=true"
}
}
},
{
"label": "Kratos: install mailhog",
"type": "shell",
"command": "make .bin/MailHog"
},
{
"label": "Kratos: start mailhog",
"type": "shell",
"presentation": {
"echo": false,
"reveal": "always",
"panel": "dedicated"
},
"dependsOn": ["Kratos: install mailhog"],
"isBackground": true,
"command": "${workspaceFolder}/.bin/MailHog -smtp-bind-addr=localhost:8026",
"problemMatcher": {
"pattern": {
"regexp": ""
},
"background": {
"activeOnStart": true,
"beginsPattern": " ",
"endsPattern": "Serving under"
}
}
},
{
"label": "Kratos: setup",
"type": "shell",
"presentation": {
"reveal": "silent"
},
"dependsOn": ["Kratos: start mailhog", "Kratos debug: setup sqlite"],
"problemMatcher": []
},
{
"label": "close tasks",
"command": "echo ${input:terminate}",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ GO_DEPENDENCIES = github.com/ory/go-acc \
github.com/go-swagger/go-swagger/cmd/swagger \
golang.org/x/tools/cmd/goimports \
github.com/mattn/goveralls \
github.com/cortesi/modd/cmd/modd
github.com/cortesi/modd/cmd/modd \
github.com/mailhog/MailHog

define make-go-dependency
# go install is responsible for not re-building when the code hasn't changed
Expand Down
20 changes: 20 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ require (
github.com/google/pprof v0.0.0-20221010195024-131d412537ea // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/gorilla/pat v1.0.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
Expand All @@ -202,6 +205,10 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/ian-kent/envconf v0.0.0-20141026121121-c19809918c02 // indirect
github.com/ian-kent/go-log v0.0.0-20160113211217-5731446c36ab // indirect
github.com/ian-kent/goose v0.0.0-20141221090059-c3541ea826ad // indirect
github.com/ian-kent/linkio v0.0.0-20170807205755-97566b872887 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.13.0 // indirect
Expand All @@ -225,6 +232,14 @@ require (
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailhog/MailHog v1.0.1 // indirect
github.com/mailhog/MailHog-Server v1.0.1 // indirect
github.com/mailhog/MailHog-UI v1.0.1 // indirect
github.com/mailhog/data v1.0.1 // indirect
github.com/mailhog/http v1.0.1 // indirect
github.com/mailhog/mhsendmail v0.2.0 // indirect
github.com/mailhog/smtp v1.0.1 // indirect
github.com/mailhog/storage v1.0.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
Expand All @@ -240,6 +255,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nyaruka/phonenumbers v1.1.6 // indirect
github.com/ogier/pflag v0.0.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand All @@ -248,6 +264,7 @@ require (
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
Expand All @@ -271,10 +288,12 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/t-k/fluent-logger-golang v1.0.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/timtadh/data-structures v0.5.3 // indirect
github.com/timtadh/lexmachine v0.2.2 // indirect
github.com/tinylib/msgp v1.1.8 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/toqueteos/webbrowser v1.2.0 // indirect
github.com/urfave/cli v1.22.5 // indirect
Expand Down Expand Up @@ -326,6 +345,7 @@ require (
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit a046778

Please sign in to comment.