From f4b75e552de95aedd96c8815d0fb3570d744b598 Mon Sep 17 00:00:00 2001 From: bodymindarts Date: Wed, 20 Sep 2023 10:30:54 +0200 Subject: [PATCH] refactor: move vars to .env --- .env | 118 +++++++++++++++++++++++++++++++++ .envrc | 112 ++----------------------------- .gitignore | 1 + Dockerfile | 5 +- Dockerfile-debug | 5 +- Dockerfile-migrate | 3 +- Dockerfile-websocket | 5 +- Makefile | 14 ++-- flake.lock | 61 +++++++++++++++++ package.json | 14 ++-- quickstart/bin/re-render.sh | 2 +- quickstart/vendir.yml | 1 + quickstart/vendir/template.yml | 1 + 13 files changed, 216 insertions(+), 126 deletions(-) create mode 100644 flake.lock diff --git a/.env b/.env index e69de29bb2d..010041896ab 100644 --- a/.env +++ b/.env @@ -0,0 +1,118 @@ +export DOCKER_HOST_IP=${DOCKER_HOST_IP:-127.0.0.1} +export NETWORK=regtest + +# dev/lnd/tls.cert.base64 +export LND1_TLS="LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZVENDQWdlZ0F3SUJBZ0lSQU9zZzdYWFR4cnVZYlhkeTY2d3RuN1F3Q2dZSUtvWkl6ajBFQXdJd09ERWYKTUIwR0ExVUVDaE1XYkc1a0lHRjFkRzluWlc1bGNtRjBaV1FnWTJWeWRERVZNQk1HQTFVRUF4TU1PRFl4T1RneApNak5tT0Roak1CNFhEVEl6TURFeE9USXdOREUxTTFvWERUTTBNRGN5TVRJd05ERTFNMW93T0RFZk1CMEdBMVVFCkNoTVdiRzVrSUdGMWRHOW5aVzVsY21GMFpXUWdZMlZ5ZERFVk1CTUdBMVVFQXhNTU9EWXhPVGd4TWpObU9EaGoKTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFM1lieUlKWU1Vcm8zZkl0UFFucysxZ2lpTXI5NQpJUXRmclFDQ2JhOWVtcjI4TENmbk1vYy9VQVFwUlg3QVlvVFRneUdiMFBuZGNUODF5ZVgvYTlPa0RLT0I4VENCCjdqQ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dyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgqHDdwGCqx0aQL1/Z3uUfzCpeBhfapGf9s/AZPOVwf6s=" +# dev/lnd/regtest/lnd2.admin.macaroon.base64 +export LND2_MACAROON="AgEDbG5kAvgBAwoQX0BxfhQTxLTiqaceBnGnfBIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgMAKlr1HehfBpn2R5RPE2IuY9r/18QBeLZxYgRidpos4=" + +# dev/lnd/regtest/lnd-outside-1.admin.macaroon.base64 +export MACAROONOUTSIDE1="AgEDbG5kAvgBAwoQeE+5exgz7/0ExCn7H6AJlBIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgL7pU+cKOt6zGyWTdWWmAJLP1L3cnbOPb4Rd3QtniyyM=" +# +# dev/lnd/regtest/lnd-outside-2.admin.macaroon.base64 +export MACAROONOUTSIDE2="AgEDbG5kAvgBAwoQfKO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E96MD0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=" + +# dev/lnd/regtest/lnd1.pubkey +export LND1_PUBKEY="03ca1907342d5d37744cb7038375e1867c24a87564c293157c95b2a9d38dcfb4c2" +# dev/lnd/regtest/lnd2.pubkey +export LND2_PUBKEY="039341ef13e776dc1611502cf510110d9ac5cdc252141f5997adcfd72cef34c3a7" + +export BITCOINDPORT=18443 + +export BITCOINDADDR=${DOCKER_HOST_IP} +export BITCOIND_SIGNER_PORT=18543 +export BITCOIND_SIGNER_ADDR=${DOCKER_HOST_IP} +export BITCOINDRPCPASS=rpcpassword + +export LND1_DNS=${DOCKER_HOST_IP} +export LND2_DNS=${DOCKER_HOST_IP} +export LNDOUTSIDE1ADDR=${DOCKER_HOST_IP} +export LNDOUTSIDE2ADDR=${DOCKER_HOST_IP} + +export LND1_RPCPORT=10009 +export LND2_RPCPORT=10010 + +export LNDOUTSIDE1RPCPORT=10012 +export LNDOUTSIDE2RPCPORT=10013 + +export LND1_TYPE=offchain,onchain +export LND2_TYPE=offchain + +export LND1_NAME=lnd1 +export LND2_NAME=lnd2 + +export MONGODB_CON=mongodb://${DOCKER_HOST_IP}:27017/galoy + +export REDIS_0_DNS=${DOCKER_HOST_IP} +export REDIS_0_PORT=6379 +export REDIS_MASTER_NAME="mymaster" +export REDIS_PASSWORD="" +export REDIS_TYPE="standalone" + +export BRIA_HOST=${DOCKER_HOST_IP} +export BRIA_PORT=2742 +export BRIA_API_KEY="bria_dev_000000000000000000000" + +export PRICE_HOST=${DOCKER_HOST_IP} +export PRICE_PORT=50051 + +export PRICE_HISTORY_HOST=${DOCKER_HOST_IP} +export PRICE_HISTORY_PORT=50052 + +export OATHKEEPER_DECISION_ENDPOINT=http://${DOCKER_HOST_IP}:4456 + +export WEBSOCKET_PORT=4000 + +export GEETEST_ID="geetest_id" +export GEETEST_KEY="geetest_key" + +export TWILIO_ACCOUNT_SID="AC_twilio_id" +export TWILIO_AUTH_TOKEN="AC_twilio_auth_token" +export TWILIO_VERIFY_SERVICE_ID="VA_twilio_service" + +export COMMITHASH="hash" +export HELMREVISION="1" + +export LOG_LEVEL="info" + +export KRATOS_MASTER_USER_PASSWORD="passwordHardtoFindWithNumber123" +export KRATOS_ADMIN_URL="http://localhost:4434" +export KRATOS_CALLBACK_API_KEY="The-Value-of-My-Key" +export KRATOS_PG_HOST="localhost" +export KRATOS_PG_PORT="5433" + +export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" +# TODO: rename to OTEL_SERVICE_NAME +# https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_service_name +export TRACING_SERVICE_NAME="galoy-dev" + +export MATTERMOST_WEBHOOK_URL="https://chat.galoy.io/hooks/sometoken" + +export KRATOS_PG_CON="postgres://dbuser:secret@localhost:5433/default?sslmode=disable" + +export UNSECURE_DEFAULT_LOGIN_CODE="000000" +export UNSECURE_IP_FROM_REQUEST_OBJECT=true + +export SVIX_SECRET="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E" +export SVIX_ENDPOINT="http://localhost:8071" +export SVIX_CALLBACK_URL=http://bats-tests:8080/webhook/ + +export KRATOS_PUBLIC_API="http://localhost:4433" +export KRATOS_ADMIN_API="http://localhost:4434" diff --git a/.envrc b/.envrc index cd576b7a050..dd40adfa2ab 100644 --- a/.envrc +++ b/.envrc @@ -1,110 +1,8 @@ -export DOCKER_HOST_IP=${DOCKER_HOST_IP:-127.0.0.1} -export NETWORK=regtest +dotenv -export LND1_TLS=$(cat dev/lnd/tls.cert.base64) -export LND2_TLS=$LND1_TLS +use flake -export TLSOUTSIDE1=$LND1_TLS -export TLSOUTSIDE2=$LND1_TLS - -export LND1_MACAROON=$(cat dev/lnd/$NETWORK/lnd1.admin.macaroon.base64) -export LND2_MACAROON=$(cat dev/lnd/$NETWORK/lnd2.admin.macaroon.base64) - -export MACAROONOUTSIDE1=$(cat dev/lnd/$NETWORK/lnd-outside-1.admin.macaroon.base64) -export MACAROONOUTSIDE2=$(cat dev/lnd/$NETWORK/lnd-outside-2.admin.macaroon.base64) - - -export LND1_LOOP_MACAROON=$(cat dev/lnd/loop/$NETWORK/loopd1-1.loop.macaroon.base64) -export LND2_LOOP_MACAROON=$(cat dev/lnd/loop/$NETWORK/loopd2-1.loop.macaroon.base64) -export LND1_LOOP_TLS=$(cat dev/lnd/loop/$NETWORK/loopd1-1.tls.cert.base64) -export LND2_LOOP_TLS=$(cat dev/lnd/loop/$NETWORK/loopd2-1.tls.cert.base64) - -export LND1_PUBKEY=$(cat dev/lnd/$NETWORK/lnd1.pubkey) -export LND2_PUBKEY=$(cat dev/lnd/$NETWORK/lnd2.pubkey) - -export BITCOINDPORT=18443 -export BITCOINDADDR=${DOCKER_HOST_IP} -export BITCOIND_SIGNER_PORT=18543 -export BITCOIND_SIGNER_ADDR=${DOCKER_HOST_IP} -export BITCOINDRPCPASS=rpcpassword - -export LND1_DNS=${DOCKER_HOST_IP} -export LND2_DNS=${DOCKER_HOST_IP} -export LNDOUTSIDE1ADDR=${DOCKER_HOST_IP} -export LNDOUTSIDE2ADDR=${DOCKER_HOST_IP} - -export LND1_RPCPORT=10009 -export LND2_RPCPORT=10010 - -export LNDOUTSIDE1RPCPORT=10012 -export LNDOUTSIDE2RPCPORT=10013 - -export LND1_TYPE=offchain,onchain -export LND2_TYPE=offchain - -export LND1_NAME=lnd1 -export LND2_NAME=lnd2 - -export MONGODB_CON=mongodb://${DOCKER_HOST_IP}:27017/galoy - -export REDIS_0_DNS=${DOCKER_HOST_IP} -export REDIS_0_PORT=6379 -export REDIS_MASTER_NAME="mymaster" -export REDIS_PASSWORD="" -export REDIS_TYPE="standalone" - -export BRIA_HOST=${DOCKER_HOST_IP} -export BRIA_PORT=2742 -export BRIA_API_KEY="bria_dev_000000000000000000000" - -export PRICE_HOST=${DOCKER_HOST_IP} -export PRICE_PORT=50051 - -export PRICE_HISTORY_HOST=${DOCKER_HOST_IP} -export PRICE_HISTORY_PORT=50052 - -export OATHKEEPER_DECISION_ENDPOINT=http://${DOCKER_HOST_IP}:4456 - -export WEBSOCKET_PORT=4000 - -export GEETEST_ID="geetest_id" -export GEETEST_KEY="geetest_key" - -export TWILIO_ACCOUNT_SID="AC_twilio_id" -export TWILIO_AUTH_TOKEN="AC_twilio_auth_token" -export TWILIO_VERIFY_SERVICE_ID="VA_twilio_service" - -export COMMITHASH="hash" -export HELMREVISION="1" - -export LOG_LEVEL="info" - -export KRATOS_MASTER_USER_PASSWORD="passwordHardtoFindWithNumber123" -export KRATOS_ADMIN_URL="http://localhost:4434" -export KRATOS_CALLBACK_API_KEY="The-Value-of-My-Key" -export KRATOS_PG_HOST="localhost" -export KRATOS_PG_PORT="5433" - -export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" -# TODO: rename to OTEL_SERVICE_NAME -# https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_service_name -export TRACING_SERVICE_NAME="galoy-dev" - -export MATTERMOST_WEBHOOK_URL="https://chat.galoy.io/hooks/sometoken" - -export KRATOS_PG_CON="postgres://dbuser:secret@localhost:5433/default?sslmode=disable" - -export UNSECURE_DEFAULT_LOGIN_CODE="000000" -export UNSECURE_IP_FROM_REQUEST_OBJECT=true - -export SVIX_SECRET="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E" -export SVIX_ENDPOINT="http://localhost:8071" -export SVIX_CALLBACK_URL=http://bats-tests:8080/webhook/ - -export KRATOS_PUBLIC_API="http://localhost:4433" -export KRATOS_ADMIN_API="http://localhost:4434" - -# add your HONEYCOMB_API_KEY and HONEYCOMB_DATASET in .envrc.secrets to test HONEYCOMB -if [ -f .envrc.secrets ]; then - source .envrc.secrets +# add your HONEYCOMB_API_KEY and HONEYCOMB_DATASET in .env.local to test HONEYCOMB +if [ -f .env.local ]; then + source .env.local fi diff --git a/.gitignore b/.gitignore index 5bda3b4b78e..c24385711ad 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ generated.gql .swc .envrc.secrets +.envrc.local # bats e2e tests - diff --git a/Dockerfile b/Dockerfile index e46773244c8..0d11f96a55a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,13 +14,16 @@ RUN yarn build RUN yarn install --frozen-lockfile --production +RUN touch .env + FROM gcr.io/distroless/nodejs20-debian11 +COPY --from=BUILD_IMAGE /app/.env /app/.env COPY --from=BUILD_IMAGE /app/lib /app/lib COPY --from=BUILD_IMAGE /app/src/config/locales /app/lib/config/locales COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules WORKDIR /app -COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./.env ./ +COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./ USER 1000 diff --git a/Dockerfile-debug b/Dockerfile-debug index 4e319692237..22e1d20c6e3 100644 --- a/Dockerfile-debug +++ b/Dockerfile-debug @@ -13,13 +13,16 @@ COPY ./test ./test RUN yarn build +RUN touch .env + FROM gcr.io/distroless/nodejs20-debian11:debug +COPY --from=BUILD_IMAGE /app/.env /app/.env COPY --from=BUILD_IMAGE /app/lib /app/lib COPY --from=BUILD_IMAGE /app/src/config/locales /app/lib/config/locales COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules WORKDIR /app -COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./.env ./ +COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./ ### debug only COPY --from=BUILD_IMAGE /app/src /app/src diff --git a/Dockerfile-migrate b/Dockerfile-migrate index b63c7911035..debc1ee6214 100644 --- a/Dockerfile-migrate +++ b/Dockerfile-migrate @@ -22,7 +22,8 @@ COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules COPY --from=BUILD_IMAGE /app/scripts /app/scripts WORKDIR /app -COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./.env ./ +COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./ +RUN touch .env ### debug only COPY --from=BUILD_IMAGE /app/src /app/src diff --git a/Dockerfile-websocket b/Dockerfile-websocket index 0f832dbe2ae..551055ea5b1 100644 --- a/Dockerfile-websocket +++ b/Dockerfile-websocket @@ -14,13 +14,16 @@ RUN yarn build RUN yarn install --frozen-lockfile --production +RUN touch .env + FROM gcr.io/distroless/nodejs20-debian11 +COPY --from=BUILD_IMAGE /app/.env /app/.env COPY --from=BUILD_IMAGE /app/lib /app/lib COPY --from=BUILD_IMAGE /app/src/config/locales /app/lib/config/locales COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules WORKDIR /app -COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./.env ./ +COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./ USER 1000 diff --git a/Makefile b/Makefile index fa66201e5e1..10a049a4c7d 100644 --- a/Makefile +++ b/Makefile @@ -10,22 +10,22 @@ update-price-history: docker compose run price-history node servers/history/cron.js start-main: - . ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ + . ./.env && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ src/servers/graphql-main-server.ts | yarn pino-pretty -c -l start-main-fast: yarn run watch-main | yarn pino-pretty -c -l start-trigger: - . ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ + . ./.env && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ src/servers/trigger.ts | yarn pino-pretty -c -l start-cron: start-deps - . ./.envrc && yarn tsnd --files -r tsconfig-paths/register -r src/services/tracing.ts \ + . ./.env && yarn tsnd --files -r tsconfig-paths/register -r src/services/tracing.ts \ src/servers/cron.ts | yarn pino-pretty -c -l start-ws: - . ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ + . ./.env && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ src/servers/ws-server.ts | yarn pino-pretty -c -l start-loopd: @@ -44,7 +44,7 @@ start-ws-ci: node lib/servers/ws-server.js exporter: start-deps - . ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ + . ./.env && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \ src/servers/exporter.ts | yarn pino-pretty -c -l watch: @@ -116,7 +116,7 @@ execute-integration-from-within-container: NODE_ENV=test LOGLEVEL=error $(BIN_DIR)/jest --config ./test/integration/jest.config.js --bail --runInBand --ci --reporters=default --reporters=jest-junit unit-in-ci: - . ./.envrc && \ + . ./.env && \ LOGLEVEL=warn $(BIN_DIR)/jest --config ./test/unit/jest.config.js --ci --bail --maxWorkers=50% check-implicit: @@ -131,7 +131,7 @@ check-code: check-implicit yarn madge-check create-tmp-env-ci: - . ./.envrc && \ + . ./.env && \ envsubst < .env.ci > tmp.env.ci # 16 is exit code for critical https://classic.yarnpkg.com/lang/en/docs/cli/audit diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..4b9f6a91083 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1694948089, + "narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/package.json b/package.json index 5977897e962..831193e2e25 100644 --- a/package.json +++ b/package.json @@ -8,24 +8,24 @@ "eslint-fix": "eslint \"{src,test}/**/*.ts\" --fix", "build": "tsc -p tsconfig-build.json && cp -R src/services/price/protos lib/services/price/ && cp -R src/services/dealer-price/proto lib/services/dealer-price/ && cp -R src/services/loopd/protos lib/services/loopd/ && cp -R src/services/bria/proto lib/services/bria/ && tscpaths --silent -p tsconfig.json -s ./src -o ./lib", "trigger": "yarn build && node lib/servers/trigger.js | pino-pretty -c -l", - "check:sdl": ". ./.envrc && yarn write-sdl && if git diff --name-only | grep -q 'src/graphql/admin/schema.graphql'; then echo 'Error: src/graphql/admin/schema.graphql has changes, run `make codegen` and re-recommit' >&2; exit 1; fi && if git diff --name-only | grep -q 'src/graphql/public/schema.graphql'; then echo 'Error: src/graphql/public/schema.graphql has changes, run `make codegen` and re-recommit' >&2; exit 1; fi", + "check:sdl": ". ./.env && yarn write-sdl && if git diff --name-only | grep -q 'src/graphql/admin/schema.graphql'; then echo 'Error: src/graphql/admin/schema.graphql has changes, run `make codegen` and re-recommit' >&2; exit 1; fi && if git diff --name-only | grep -q 'src/graphql/public/schema.graphql'; then echo 'Error: src/graphql/public/schema.graphql has changes, run `make codegen` and re-recommit' >&2; exit 1; fi", "write-sdl": "yarn build && node lib/servers/write-sdl.js write-sdl.yaml && rover supergraph compose --config dev/apollo-federation/supergraph-config.yaml --elv2-license accept > dev/apollo-federation/supergraph.graphql", "ws": "yarn build && node lib/servers/ws-server.js | pino-pretty -c -l", "watch": "nodemon -V -e ts,graphql -w ./src -x yarn run start", "watch-trigger": "nodemon -V -e ts,graphql -w ./src -x yarn trigger", "graphql-check": "curl -fsS https://raw.githubusercontent.com/GaloyMoney/galoy-mobile/main/app/graphql/generated.gql -o generated.gql && npx @graphql-inspector/cli validate ./generated.gql src/graphql/public/schema.graphql --apollo --noStrictFragments", - "cron": ". ./.envrc && yarn build && node lib/servers/cron.js", + "cron": ". ./.env && yarn build && node lib/servers/cron.js", "exporter": "yarn build && node lib/servers/exporter.js", "daily-notif": "yarn build && node lib/servers/daily-balance-notification.js", "test": "export JEST_JUNIT_OUTPUT_DIR=\"./artifacts\" && jest --ci --reporters=default --reporters=jest-junit", - "test:unit": ". ./.envrc && LOGLEVEL=warn jest --config ./test/unit/jest.config.js --bail --verbose $TEST | yarn pino-pretty -c -l", - "test:legacy-integration": ". ./.envrc && LOGLEVEL=warn jest --config ./test/legacy-integration/jest.config.js --bail --runInBand --verbose $TEST | yarn pino-pretty -c -l", - "test:integration": ". ./.envrc && LOGLEVEL=warn jest --config ./test/integration/jest.config.js --bail --runInBand --verbose $TEST | yarn pino-pretty -c -l", + "test:unit": ". ./.env && LOGLEVEL=warn jest --config ./test/unit/jest.config.js --bail --verbose $TEST | yarn pino-pretty -c -l", + "test:legacy-integration": ". ./.env && LOGLEVEL=warn jest --config ./test/legacy-integration/jest.config.js --bail --runInBand --verbose $TEST | yarn pino-pretty -c -l", + "test:integration": ". ./.env && LOGLEVEL=warn jest --config ./test/integration/jest.config.js --bail --runInBand --verbose $TEST | yarn pino-pretty -c -l", "build-docs": "npx spectaql spectaql-config.yml -1", "fix-yaml": "prettier --write '**/*.(yaml|yml)'", "check-yaml": "prettier --check '**/*.(yaml|yml)'", - "watch-main": ". ./.envrc && nodemon -V -e ts,graphql -w ./src --exec yarn run start-main", - "start-main": ". ./.envrc && yarn run build && node --inspect -r ./lib/services/tracing.js ./lib/servers/graphql-main-server.js", + "watch-main": ". ./.env && nodemon -V -e ts,graphql -w ./src --exec yarn run start-main", + "start-main": ". ./.env && yarn run build && node --inspect -r ./lib/services/tracing.js ./lib/servers/graphql-main-server.js", "migrate-mongo-up": "migrate-mongo up -f './src/migrations/migrate-mongo-config.js'", "gen-test-jwt": "ts-node ./dev/bin/gen-test-jwt.ts" }, diff --git a/quickstart/bin/re-render.sh b/quickstart/bin/re-render.sh index 88c913e2a4e..4a38377528b 100755 --- a/quickstart/bin/re-render.sh +++ b/quickstart/bin/re-render.sh @@ -14,7 +14,7 @@ vendir sync ytt -f ./docker-compose.tmpl.yml -f ${GALOY_ROOT_DIR}/docker-compose.yml -f ${GALOY_ROOT_DIR}/docker-compose.override.yml > docker-compose.yml pushd ${GALOY_ROOT_DIR} -source .envrc +source .env mkdir -p "${GALOY_ROOT_DIR}/../vendor/galoy-quickstart/env" export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318 diff --git a/quickstart/vendir.yml b/quickstart/vendir.yml index 305aca564f3..ae2e68d6d76 100644 --- a/quickstart/vendir.yml +++ b/quickstart/vendir.yml @@ -23,6 +23,7 @@ directories: - dev/**/* - test/bats/bitcoind_signer_descriptors.json - test/bats/gql/* + - .env - .envrc - .env.ci - docker-compose.yml diff --git a/quickstart/vendir/template.yml b/quickstart/vendir/template.yml index 08ade2a8e11..3966bbc96ea 100644 --- a/quickstart/vendir/template.yml +++ b/quickstart/vendir/template.yml @@ -26,6 +26,7 @@ directories: - dev/**/* - test/bats/bitcoind_signer_descriptors.json - test/bats/gql/* + - .env - .envrc - .env.ci - docker-compose.yml