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

chore: add launch config for VSCode #3239

Merged
merged 3 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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