-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.env.example
More file actions
111 lines (92 loc) · 8.81 KB
/
.env.example
File metadata and controls
111 lines (92 loc) · 8.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#Needed while running the service
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" #The database url for the database to be used. Please ensure it is migrated (the tables are created) and optionally seeded (some initial data is inserted). See the README for more information on how to do this.
DATABASE_CA_CERT="" #***OPTIONAL*** PEM-encoded CA certificate for SSL database connections (e.g. self-signed certificates). Use literal \n for newlines. When set, the certificate is written to certs/ca-certificate.crt and referenced via sslrootcert in the connection string.
ENCRYPTION_KEY="12345678901234567890123456789012" #This is a secret key used to encrypt the sensitive wallet secrets in the database. Please change this to a secure string of at least 32 characters.
PORT= "3001" #The port to run the server on (default is 3001)
#The services will run the following jobs whenever previous ones completed or after the provided time
BATCH_PAYMENT_INTERVAL="240" #delay in seconds for batching requests every 4 minutes
CHECK_COLLECTION_INTERVAL="300" #delay in seconds for checking collection every 5 minutes
CHECK_TX_INTERVAL="180" #delay in seconds for checking payment every 3 minutes
CHECK_COLLECT_REFUND_INTERVAL="300" #delay in seconds for checking collection and refund every 5 minutes
CHECK_SET_REFUND_INTERVAL="300" #delay in seconds for checking set refund every 5 minutes
CHECK_UNSET_REFUND_INTERVAL="300" #delay in seconds for checking unset refund every 5 minutes
CHECK_AUTHORIZE_REFUND_INTERVAL="300" #delay in seconds for checking authorize refund every 5 minutes
CHECK_SUBMIT_RESULT_INTERVAL="300" #delay in seconds for checking submit result every 5 minutes
CHECK_WALLET_TRANSACTION_HASH_INTERVAL="60" #delay in seconds for checking wallet transaction hash every 1 minute this also reruns potentially effected services by unlocking the wallet
SYNC_LOCK_TIMEOUT_INTERVAL="30" #Time before a locked payment source will be unlocked and retried
REGISTER_AGENT_INTERVAL="300" #delay in seconds for registering agent every 5 minutes
DEREGISTER_AGENT_INTERVAL="300" #delay in seconds for deregistering agent every 5 minutes
AUTO_DECISION_INTERVAL="30" #delay between auto decisions defaults to 30 seconds
WEBHOOK_DELIVERY_INTERVAL="10" #delay in seconds for processing webhook deliveries every 10 seconds (minimum 5 seconds)
WEBHOOK_CLEANUP_INTERVAL="86400" #delay in seconds for deleting old webhook deliveries every 24 hours
LOW_BALANCE_CHECK_INTERVAL="60" #delay in seconds for checking monitored wallet balances for low-balance warnings
LOW_BALANCE_DEFAULT_RULES_PREPROD='{"lovelace":"5000000"}' #default low-balance rules for newly created preprod hot wallets
LOW_BALANCE_DEFAULT_RULES_MAINNET='{"lovelace":"5000000"}' #default low-balance rules for newly created mainnet hot wallets
#In case you want to configure open telemetry this is what you want to configure(Signoz)
OTEL_SERVICE_NAME="masumi-payment-service" #default name of the service in logs
OTEL_SERVICE_VERSION="0.1.0" #Use this to configure your endpoint
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.eu.signoz.cloud:443" #Use this to configure your endpoint
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="" #Use this to configure your endpoint
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="" #Use this to configure your endpoint
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=""
SIGNOZ_INGESTION_KEY="" #Can be used for example to implement SigNoz cloud via 1 Click setups
# Prisma span filtering: only export slow (outlier) DB queries and cap volume
OTEL_PRISMA_OUTLIER_THRESHOLD_MS="100" # Only export Prisma spans with duration >= this (ms). Default 100.
OTEL_PRISMA_MAX_SPANS_PER_MINUTE="60" # Max Prisma spans exported per minute. Default 60.
BLOCK_CONFIRMATIONS_THRESHOLD="20" #The minimum amount of confirmations for a tx to be recognized
AUTO_WITHDRAW_PAYMENTS="true" #should payments be automatically withdrawn after completion. If not set to false. Defaults to true
AUTO_WITHDRAW_REFUNDS="true" #should refunds be automatically withdrawn. If not set to false. Defaults to true
#The following data is only needed while seeding
ADMIN_KEY="abcdef_this_should_be_very_secure" #The key of the admin user, this key will have all permissions, like doing payments, changing configurations and can also be used to create new (more limited) api_keys
SEED_ONLY_IF_EMPTY=True #***Optionally*** Will skip seeding if there are entries in the db
#The following data is only needed for preprod seeding
BLOCKFROST_API_KEY_PREPROD="" #Your blockfrost api key. It is required to interact with the blockchain. Receive a free key at https://blockfrost.io/ for the network you are using (e.g. preprod)
PURCHASE_WALLET_PREPROD_MNEMONIC="" #***OPTIONAL*** The mnemonic of the wallet used to purchase any agent requests. This needs to have sufficient funds to pay, or be topped up. If you do not provide a mnemonic, a new one will be generated. Please ensure you export them immediately after creation and store them securely.
SELLING_WALLET_PREPROD_MNEMONIC="" #***OPTIONAL*** The mnemonic of the wallet used to interact with the smart contract. This only needs minimal funds, to cover the CARDANO Network fees. If you do not provide a mnemonic, a new one will be generated. Please ensure you export them immediately after creation and store them securely.
COLLECTION_WALLET_PREPROD_ADDRESS="" #***OPTIONAL*** The wallet address of the collection wallet. It will receive all payments after a successful and completed purchase (not refund). It does not need any funds, however it is strongly recommended to create it via a hardware wallet or ensure its secret is stored securely. If you do not provide an address, the SELLING_WALLET will be used.
COINGECKO_API_KEY="CG-demo-key" #Works with either a demo or normal key
IS_COINGECKO_DEMO="true" #In case it is a demo key set this to true
#The following data is only needed for mainnet seeding
BLOCKFROST_API_KEY_MAINNET="" #Your blockfrost api key. It is required to interact with the blockchain. Receive a free key at https://blockfrost.io/ for the network you are using (e.g. mainnet)
#Used to configure payment and purchase wallets
PURCHASE_WALLET_MAINNET_MNEMONIC="" #***OPTIONAL*** The mnemonic of the wallet used to purchase any agent requests. This needs to have sufficient funds to pay, or be topped up. If you do not provide a mnemonic, a new one will be generated. Please ensure you export them immediately after creation and store them securely.
SELLING_WALLET_MAINNET_MNEMONIC="" #***OPTIONAL*** The mnemonic of the wallet used to interact with the smart contract. This only needs minimal funds, to cover the CARDANO Network fees. If you do not provide a mnemonic, a new one will be generated. Please ensure you export them immediately after creation and store them securely.
COLLECTION_WALLET_MAINNET_ADDRESS="" #***OPTIONAL BUT STRONGLY RECOMMENDED*** The wallet address of the collection wallet. It will receive all payments after a successful and completed purchase (not refund). It does not need any funds, however it is strongly recommended to create it via a hardware wallet or ensure its secret is stored securely. If you do not provide an address, the SELLING_WALLET will be used.
# ====================CONFIG for E2E TESTING========================
#E2E Testing Configuration
TEST_API_KEY="DefaultTestApiKey12345" #API key for E2E tests - must be seeded in database (22 characters recommended)
TEST_NETWORK="Preprod" #Cardano network for E2E tests (Preprod, Mainnet, or Preview)
TEST_API_URL="http://localhost:3001" #API server URL for E2E tests
# =============================================================================
# SETUP INSTRUCTIONS FOR RUNNING TESTS
# =============================================================================
# 1. Create a test PostgreSQL database:
# createdb masumi_payment_service_test
#
# 2. Update DATABASE_URL with your test database credentials
#
# 3. Run database migrations:
# pnpm exec prisma migrate dev
#
# 4. Seed the database with test data:
# pnpm exec prisma db seed
#
# 5. Start the development server:
# pnpm run dev
#
# 6. Run E2E tests:
# pnpm run test:e2e
#
# 7. Run specific test flows:
# pnpm run test:e2e -- tests/e2e/flows/complete-flow-with-refund.test.ts
# pnpm run test:e2e -- tests/e2e/flows/early-refund-complete-flow.test.ts
# pnpm run test:e2e -- tests/e2e/flows/cancel-refund-request-flow.test.ts
# pnpm run test:e2e -- tests/e2e/flows/agent-deregister-delete-flow.test.ts
# =============================================================================
# IMPORTANT NOTES
# =============================================================================
# - Use a separate test database to avoid data conflicts
# - Ensure TEST_API_KEY is properly seeded in your database
# - The tests interact with real Cardano Preprod blockchain
# - Tests can take 10-20 minutes to complete due to blockchain confirmations
# - Make sure your server is running before executing E2E tests