From 6d5fbab63df3928e527cfebf02804262e8996f08 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:36:21 -0400 Subject: [PATCH 1/5] chore: remove extra quotation marks in env file build --- toolchains/workspace-pnpm/macros.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchains/workspace-pnpm/macros.bzl b/toolchains/workspace-pnpm/macros.bzl index de1e8de49b..275ad8eb6d 100644 --- a/toolchains/workspace-pnpm/macros.bzl +++ b/toolchains/workspace-pnpm/macros.bzl @@ -1037,7 +1037,7 @@ def dict_to_env_string(input_dict): # TODO: handle different types of 'value' instead of casting everything to string for key, value in input_dict.items(): - env_strings.append('export ' + key +'="' + str(value) + '"') + env_strings.append('export ' + key +'=' + str(value)) return '\n'.join(env_strings) From 636d54d7b0707ad2b5f4b63c5022c1f5bbabda99 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:36:49 -0400 Subject: [PATCH 2/5] test(core): add some missing env variables for cron task --- core/api/BUCK | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/api/BUCK b/core/api/BUCK index df396d0053..c3657e90da 100644 --- a/core/api/BUCK +++ b/core/api/BUCK @@ -256,7 +256,15 @@ dev_pnpm_task_binary( srcs = [":src"], visibility = ["PUBLIC"], env = { + "REDIS_0_PORT": "6379", + "REDIS_TYPE": "standalone", + "MONGODB_CON": "mongodb://localhost:27017/galoy", + "BRIA_HOST": "localhost", + "BRIA_API_KEY": "bria_dev_000000000000000000000", + "REDIS_MASTER_NAME": "mymaster", + "REDIS_PASSWORD": "", + "REDIS_0_DNS": "localhost", "HELMREVISION": "dummy", "KRATOS_PG_CON": "pg://dummy", @@ -269,11 +277,6 @@ dev_pnpm_task_binary( "KRATOS_ADMIN_API": "http://dummy", "KRATOS_MASTER_USER_PASSWORD": "dummy", "KRATOS_CALLBACK_API_KEY": "dummy", - "BRIA_HOST": "dummy", - "BRIA_API_KEY": "dummy", - "REDIS_MASTER_NAME": "dummy", - "REDIS_PASSWORD": "dummy", - "REDIS_0_DNS": "dummy", }, ) From 96c8cc5e64c4917ec6665d8cc699a8453a1edde9 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:36:57 -0400 Subject: [PATCH 3/5] revert(core): add some missing env variables for cron task This reverts commit 636d54d7b0707ad2b5f4b63c5022c1f5bbabda99. --- core/api/BUCK | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/api/BUCK b/core/api/BUCK index c3657e90da..df396d0053 100644 --- a/core/api/BUCK +++ b/core/api/BUCK @@ -256,15 +256,7 @@ dev_pnpm_task_binary( srcs = [":src"], visibility = ["PUBLIC"], env = { - "REDIS_0_PORT": "6379", - "REDIS_TYPE": "standalone", - "MONGODB_CON": "mongodb://localhost:27017/galoy", - "BRIA_HOST": "localhost", - "BRIA_API_KEY": "bria_dev_000000000000000000000", - "REDIS_MASTER_NAME": "mymaster", - "REDIS_PASSWORD": "", - "REDIS_0_DNS": "localhost", "HELMREVISION": "dummy", "KRATOS_PG_CON": "pg://dummy", @@ -277,6 +269,11 @@ dev_pnpm_task_binary( "KRATOS_ADMIN_API": "http://dummy", "KRATOS_MASTER_USER_PASSWORD": "dummy", "KRATOS_CALLBACK_API_KEY": "dummy", + "BRIA_HOST": "dummy", + "BRIA_API_KEY": "dummy", + "REDIS_MASTER_NAME": "dummy", + "REDIS_PASSWORD": "dummy", + "REDIS_0_DNS": "dummy", }, ) From b45bd70750f60e595fcad321f4e2f41732c1a2cd Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 9 Jan 2024 12:07:32 -0400 Subject: [PATCH 4/5] test(core): swap env dict for env file in dev_pnpm_task_binary rule --- core/api/BUCK | 21 +-------------------- toolchains/workspace-pnpm/macros.bzl | 26 ++++++++------------------ 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/core/api/BUCK b/core/api/BUCK index df396d0053..1e8d95c08c 100644 --- a/core/api/BUCK +++ b/core/api/BUCK @@ -255,26 +255,7 @@ dev_pnpm_task_binary( command = "dev:cron", srcs = [":src"], visibility = ["PUBLIC"], - env = { - "MONGODB_CON": "mongodb://localhost:27017/galoy", - - "HELMREVISION": "dummy", - "KRATOS_PG_CON": "pg://dummy", - "OATHKEEPER_DECISION_ENDPOINT": "http://dummy", - "NETWORK": "regtest", - "TWILIO_ACCOUNT_SID": "dummy", - "TWILIO_AUTH_TOKEN": "dummy", - "TWILIO_VERIFY_SERVICE_ID": "dummy", - "KRATOS_PUBLIC_API": "http://dummy", - "KRATOS_ADMIN_API": "http://dummy", - "KRATOS_MASTER_USER_PASSWORD": "dummy", - "KRATOS_CALLBACK_API_KEY": "dummy", - "BRIA_HOST": "dummy", - "BRIA_API_KEY": "dummy", - "REDIS_MASTER_NAME": "dummy", - "REDIS_PASSWORD": "dummy", - "REDIS_0_DNS": "dummy", - }, + env_file = ".env", ) dev_pnpm_task_binary( diff --git a/toolchains/workspace-pnpm/macros.bzl b/toolchains/workspace-pnpm/macros.bzl index 275ad8eb6d..f50b68fef9 100644 --- a/toolchains/workspace-pnpm/macros.bzl +++ b/toolchains/workspace-pnpm/macros.bzl @@ -1032,18 +1032,7 @@ def madge_check( **kwargs, ) -def dict_to_env_string(input_dict): - env_strings = [] - - # TODO: handle different types of 'value' instead of casting everything to string - for key, value in input_dict.items(): - env_strings.append('export ' + key +'=' + str(value)) - - return '\n'.join(env_strings) - def pnpm_task_binary_impl(ctx: AnalysisContext) -> list[[DefaultInfo, RunInfo]]: - env_file = ctx.actions.write(".env", dict_to_env_string(ctx.attrs.env), is_executable = True) - script = ctx.actions.write("pnpm-run.sh", """\ #!/usr/bin/env bash set -euo pipefail @@ -1059,7 +1048,9 @@ if [ "$install_node_modules" = "True" ]; then pnpm install --frozen-lockfile fi -source "$env_file" +if [[ -f "$env_file" ]]; then + source "$env_file" +fi if [ "${*:5}" ]; then exec pnpm run --report-summary "$npm_run_command" -- "${@:5}" @@ -1068,6 +1059,7 @@ else fi """, is_executable = True) + env_file = ctx.attrs.env_file if ctx.attrs.env_file else "" args = cmd_args([ script, str(ctx.attrs.local_node_modules), @@ -1085,12 +1077,10 @@ dev_pnpm_task_binary = rule(impl = pnpm_task_binary_impl, attrs = { "local_node_modules": attrs.bool(default = True, doc = """Need to run pnpm install first?"""), "srcs": attrs.list(attrs.source(), default = [], doc = """List of sources we require"""), "deps": attrs.list(attrs.source(), default = [], doc = """List of dependencies we require"""), - "env": attrs.dict( - key = attrs.string(), - value = attrs.arg(), - sorted = False, - default = {}, - doc = """Env values to inject for pnpm command run""" + "env_file": attrs.option( + attrs.string(), + doc = """File name and relative path for env variables required.""", + default = None, ), }) From 25f164ffa27951c276ebec92c93e58c851c147b4 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 9 Jan 2024 13:06:45 -0400 Subject: [PATCH 5/5] fix(build): add missing lnd2 env variables to tiltfile --- dev/Tiltfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/Tiltfile b/dev/Tiltfile index 1097a10598..e4a13c2b5d 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -225,6 +225,7 @@ core_serve_env = { "UNSECURE_DEFAULT_LOGIN_CODE": "000000", "GEETEST_ID": "geetest_id", "GEETEST_KEY": "geetest_key", + "LND1_TLS": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZVENDQWdlZ0F3SUJBZ0lSQU9zZzdYWFR4cnVZYlhkeTY2d3RuN1F3Q2dZSUtvWkl6ajBFQXdJd09ERWYKTUIwR0ExVUVDaE1XYkc1a0lHRjFkRzluWlc1bGNtRjBaV1FnWTJWeWRERVZNQk1HQTFVRUF4TU1PRFl4T1RneApNak5tT0Roak1CNFhEVEl6TURFeE9USXdOREUxTTFvWERUTTBNRGN5TVRJd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ZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgqHDdwGCqx0aQL1/Z3uUfzCpeBhfapGf9s/AZPOVwf6s=", "LND1_PUBKEY":"03ca1907342d5d37744cb7038375e1867c24a87564c293157c95b2a9d38dcfb4c2", @@ -232,6 +233,15 @@ core_serve_env = { "LND1_RPCPORT": "10009", "LND1_NAME": "lnd1", "LND1_TYPE": "offchain,onchain", + + "LND2_TLS": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZVENDQWdlZ0F3SUJBZ0lSQU9zZzdYWFR4cnVZYlhkeTY2d3RuN1F3Q2dZSUtvWkl6ajBFQXdJd09ERWYKTUIwR0ExVUVDaE1XYkc1a0lHRjFkRzluWlc1bGNtRjBaV1FnWTJWeWRERVZNQk1HQTFVRUF4TU1PRFl4T1RneApNak5tT0Roak1CNFhEVEl6TURFeE9USXdOREUxTTFvWERUTTBNRGN5TVRJd05ERTFNMW93T0RFZk1CMEdBMVVFCkNoTVdiRzVrSUdGMWRHOW5aVzVsY21GMFpXUWdZMlZ5ZERFVk1CTUdBMVVFQXhNTU9EWXhPVGd4TWpObU9EaGoKTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFM1lieUlKWU1Vcm8zZkl0UFFucysxZ2lpTXI5NQpJUXRmclFDQ2JhOWVtcjI4TENmbk1vYy9VQVFwUlg3QVlvVFRneUdiMFBuZGNUODF5ZVgvYTlPa0RLT0I4VENCCjdqQU9CZ05WSFE4QkFmOEVCQU1DQXFRd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSE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S": "localhost", + "LND2_RPCPORT": "10010", + "LND2_NAME": "lnd2", + "LND2_TYPE": "offchain", + "SVIX_SECRET": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E", "SVIX_ENDPOINT": "http://localhost:8071", "EXPORTER_PORT": "3003"