Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1e003e0
[Reputation Oracle][Recording Oracle] Change event type task_complete…
flopez7 Sep 27, 2024
2bb8111
[CVAT][Exchange Oracle] Return correct url from `get_reputation_oracl…
Bobronium Sep 30, 2024
99d1156
Add vercel config file to allow window.location.reload() (#2578)
portuu3 Oct 2, 2024
6f481b0
[Human App frontend] Fix UpdateVersionModal links colors (#2583)
flopez7 Oct 3, 2024
06cb7fd
Bump openpgp from 5.11.1 to 5.11.2 (#2571)
dependabot[bot] Oct 3, 2024
16f66c5
Bump @nomicfoundation/hardhat-verify from 2.0.9 to 2.0.11 (#2570)
dependabot[bot] Oct 3, 2024
93fb3ae
Bump @mui/icons-material from 5.16.7 to 6.1.1 (#2568)
dependabot[bot] Oct 3, 2024
0035a3e
Bump @vitest/ui from 1.6.0 to 2.1.1 (#2567)
dependabot[bot] Oct 3, 2024
e2b2a35
[Fortune Exchange Oracle] Allow reassignation (#2584)
flopez7 Oct 3, 2024
5745f16
Fix recording oracle algorithm to clasify workers solutions (#2582)
flopez7 Oct 3, 2024
cd5ff4d
[Exchange Oracle] Add test for reassignation (#2585)
flopez7 Oct 3, 2024
d3719d9
Bump @testing-library/jest-dom from 6.4.8 to 6.5.0 (#2569)
dependabot[bot] Oct 4, 2024
0c6f11e
Improved autogenerated env docs (#2575)
0xVoronov Oct 4, 2024
7d2ac98
fix build error in job launcher server (#2590)
portuu3 Oct 4, 2024
869b24d
[CVAT][Exchange Oracle] Add EscrowValidation and optimise state track…
Bobronium Oct 4, 2024
789cf0a
[HUMAN App] Fixed crashing error (#2573)
0xVoronov Oct 4, 2024
0ff14ed
Disable Hcaptcha Labeling and Job Discovery for non approved users (#…
flopez7 Oct 4, 2024
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
2 changes: 1 addition & 1 deletion packages/apps/dashboard/ui-2024/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.18",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^5.15.18",
"@mui/styled-engine-sc": "6.0.0-alpha.18",
"@mui/x-date-pickers": "^7.5.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/apps/dashboard/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@human-protocol/sdk": "*",
"@mui/icons-material": "^5.15.11",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^5.16.7",
"@reduxjs/toolkit": "^2.2.7",
"@tanstack/query-sync-storage-persister": "^5.38.0",
Expand All @@ -25,7 +25,7 @@
"jszip": "^3.10.1",
"nft.storage": "^7.2.0",
"numeral": "^2.0.6",
"openpgp": "^5.11.1",
"openpgp": "^5.11.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-gtm-module": "^2.0.11",
Expand All @@ -41,7 +41,7 @@
"web-vitals": "^4.2.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^15.0.7",
"@types/crypto-js": "^4.1.2",
"@types/file-saver": "^2.0.5",
Expand Down
160 changes: 64 additions & 96 deletions packages/apps/fortune/exchange-oracle/server/ENV.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,98 @@
# Environment Variables

### POSTGRES_URL
The URL for connecting to the PostgreSQL database.
Required
### The URL for connecting to the PostgreSQL database.
POSTGRES_URL=

### POSTGRES_HOST
The hostname or IP address of the PostgreSQL database server.
Required
### The hostname or IP address of the PostgreSQL database server. Default: '127.0.0.1'
POSTGRES_HOST="127.0.0.1"

### POSTGRES_PORT
The port number on which the PostgreSQL database server is listening.
Required
### The port number on which the PostgreSQL database server is listening. Default: 5432
POSTGRES_PORT="5432"

### POSTGRES_USER
The username for authenticating with the PostgreSQL database.
Required
### The username for authenticating with the PostgreSQL database. Default: 'operator'
POSTGRES_USER="operator"

### POSTGRES_PASSWORD
The password for authenticating with the PostgreSQL database.
Required
### The password for authenticating with the PostgreSQL database. Default: 'qwerty'
POSTGRES_PASSWORD="qwerty"

### POSTGRES_DATABASE
The name of the PostgreSQL database to connect to.
Default: 'exchange-oracle'
### The name of the PostgreSQL database to connect to. Default: 'exchange-oracle'
POSTGRES_DATABASE="exchange-oracle"

### POSTGRES_SSL
Indicates whether to use SSL for connections to the PostgreSQL database.
Default: false
### Indicates whether to use SSL for connections to the PostgreSQL database. Default: false
POSTGRES_SSL="false"

### POSTGRES_LOGGING
The logging level for PostgreSQL operations (e.g., 'debug', 'info').
Required
### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Default: 'log,info,warn,error'
POSTGRES_LOGGING="log,info,warn,error"

### RPC_URL_SEPOLIA
The RPC URL for the Sepolia network.
Required
### The RPC URL for the Sepolia network.
RPC_URL_SEPOLIA=

### RPC_URL_POLYGON
The RPC URL for the Polygon network.
Required
### The RPC URL for the Polygon network.
RPC_URL_POLYGON=

### RPC_URL_POLYGON_AMOY
The RPC URL for the Polygon Amoy network.
Required
### The RPC URL for the Polygon Amoy network.
RPC_URL_POLYGON_AMOY=

### RPC_URL_BSC_MAINNET
The RPC URL for the BSC Mainnet network.
Required
### The RPC URL for the BSC Mainnet network.
RPC_URL_BSC_MAINNET=

### RPC_URL_BSC_TESTNET
The RPC URL for the BSC Testnet network.
Required
### The RPC URL for the BSC Testnet network.
RPC_URL_BSC_TESTNET=

### RPC_URL_MOONBEAM
The RPC URL for the Moonbeam network.
Required
### The RPC URL for the Moonbeam network.
RPC_URL_MOONBEAM=

### RPC_URL_XLAYER
The RPC URL for the XLayer network.
Required
### The RPC URL for the XLayer network.
RPC_URL_XLAYER=

### RPC_URL_LOCALHOST
The RPC URL for the Localhost network.
Required
### The RPC URL for the Localhost network.
RPC_URL_LOCALHOST=

### PGP_ENCRYPT
Indicates whether PGP encryption should be used.
Default: false
### Indicates whether PGP encryption should be used. Default: false
PGP_ENCRYPT="false"

### PGP_PRIVATE_KEY
The private key used for PGP encryption or decryption.
Required
### The private key used for PGP encryption or decryption.
PGP_PRIVATE_KEY=

### PGP_PASSPHRASE
The passphrase associated with the PGP private key.
Required
### The passphrase associated with the PGP private key.
PGP_PASSPHRASE=

### S3_ENDPOINT
The endpoint URL for connecting to the S3 service.
Default: '127.0.0.1'
### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1'
S3_ENDPOINT="127.0.0.1"

### S3_PORT
The port number for connecting to the S3 service.
Default: 9000
### The port number for connecting to the S3 service. Default: 9000
S3_PORT="9000"

### S3_ACCESS_KEY
The access key ID used to authenticate requests to the S3 service.
Required
### The access key ID used to authenticate requests to the S3 service. Required
S3_ACCESS_KEY=

### S3_SECRET_KEY
The secret access key used to authenticate requests to the S3 service.
Required
### The secret access key used to authenticate requests to the S3 service. Required
S3_SECRET_KEY=

### S3_BUCKET
The name of the S3 bucket where files will be stored.
Default: 'exchange'
### The name of the S3 bucket where files will be stored. Default: 'exchange'
S3_BUCKET="exchange"

### S3_USE_SSL
Indicates whether to use SSL (HTTPS) for connections to the S3 service.
Default: false
### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false
S3_USE_SSL="false"

### NODE_ENV
The environment in which the server is running (e.g., 'development', 'production').
Default: 'development'
### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development'
NODE_ENV="development"

### HOST
The hostname or IP address on which the server will run.
Default: 'localhost'
### The hostname or IP address on which the server will run. Default: 'localhost'
HOST="localhost"

### PORT
The port number on which the server will listen for incoming connections.
Default: 5000
### The port number on which the server will listen for incoming connections. Default: 5000
PORT="5000"

### FE_URL
The URL of the frontend application that the server will communicate with.
Default: 'http://localhost:3005'
### The URL of the frontend application that the server will communicate with. Default: 'http://localhost:3005'
FE_URL="http://localhost:3005"

### MAX_RETRY_COUNT
The maximum number of retry attempts for certain operations.
Default: 5
### The maximum number of retry attempts for certain operations. Default: 5
MAX_RETRY_COUNT="5"

### WEB3_ENV
The environment in which the Web3 application is running.
Default: 'testnet'
### The environment in which the Web3 application is running. Default: 'testnet'
WEB3_ENV="testnet"

### WEB3_PRIVATE_KEY
The private key used for signing transactions.
Required
### The private key used for signing transactions. Required
WEB3_PRIVATE_KEY=

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ const CONFIG_FOLDER_PATH = path.join(__dirname, '../src/common/config');
const OUTPUT_FILE_PATH = path.join(__dirname, '../ENV.md');

const envVarRegex =
/(?:this\.configService\.)?(?:getOrThrow|get)(?:<[\w<>[\]]+>)?\(\s*'(\w+)'\s*(?:,\s*[^)]*)?\)/gs;
const commentRegex = /\/\*\*([^*]*\*+([^/*][^*]*\*+)*)\//g;
/(?:this\.configService\.)?(?:getOrThrow|get)(?:<[\w<>[\]]+>)?\(\s*'(\w+)'\s*(?:,\s*([^)]*))?\)/gs; // captures variable name and additional options
const commentRegex = /\/\*\*([^*]*\*+([^/*][^*]*\*+)*)\//g; // captures comments

function extractEnvVarsWithComments(content: string) {
const envVarsWithComments: { comment: string; envVar: string }[] = [];
const envVarsWithComments: {
comment: string;
envVar: string;
defaultValue?: string;
}[] = [];
let match: RegExpExecArray | null;

// Extract comments
Expand All @@ -19,49 +23,76 @@ function extractEnvVarsWithComments(content: string) {
.split('\n') // Split the comment by lines
.map((line) => line.replace(/^\s*\*\s?/, '').trim()) // Remove leading * and extra whitespace
.filter((line) => line.length > 0) // Remove any empty lines
.join('\n'); // Join lines back with line breaks
.join(' '); // Join lines back with spaces (not line breaks)
comments.push(cleanedComment);
}

// Extract environment variables and their comments
const envVarsMap = new Map<string, string>();
const envVarsMap = new Map<
string,
{ comment: string; defaultValue?: string; required?: boolean }
>();
let commentIndex = 0;

while ((match = envVarRegex.exec(content)) !== null) {
const envVar = match[1];
const additionalOptions = match[2]; // capture additional options

// Skip variables without comments
if (!comments[commentIndex]) {
commentIndex++;
continue;
}

if (!envVarsMap.has(envVar)) {
if (comments[commentIndex]) {
const comment = comments[commentIndex];
envVarsMap.set(envVar, comment);
const comment = comments[commentIndex] || '';
let required = false;
let defaultValue: string | undefined;

// Check if the additional options include a default value or a required marker
if (additionalOptions) {
const defaultMatch = additionalOptions.match(/['"]([^'"]+)['"]/); // Match default values inside quotes
if (defaultMatch) {
defaultValue = defaultMatch[1];
}
required = additionalOptions.includes('required');
}

// Check for default values in comments
const defaultCommentMatch = comment.match(
/Default:\s*['"]?([^'"]+)['"]?/,
);
if (defaultCommentMatch) {
defaultValue = defaultCommentMatch[1];
}

envVarsMap.set(envVar, {
comment: `${comment}${required ? ' (Required)' : ''}${defaultValue ? `` : ''}`,
defaultValue,
required,
});
commentIndex++;
}
}

envVarsMap.forEach((comment, envVar) => {
envVarsWithComments.push({ comment, envVar });
envVarsMap.forEach(({ comment, defaultValue }, envVar) => {
envVarsWithComments.push({ comment, envVar, defaultValue });
});

return envVarsWithComments;
}

function generateEnvMarkdown(
envVarsWithComments: { comment: string; envVar: string }[],
envVarsWithComments: {
comment: string;
envVar: string;
defaultValue?: string;
}[],
) {
let markdown = '# Environment Variables\n\n';
let currentSection: string | null = null;

envVarsWithComments.forEach(({ comment, envVar }) => {
if (comment.startsWith('Web3 config variables')) {
if (currentSection) {
markdown += `\n\n`;
}
markdown += `## ${comment}\n\n`;
currentSection = comment;
} else {
markdown += `### ${envVar}\n`;
markdown += `${comment}\n\n`;
}
envVarsWithComments.forEach(({ comment, envVar, defaultValue }) => {
markdown += `### ${comment}\n${envVar}${defaultValue !== undefined ? `="${defaultValue}"` : '='}\n\n`;
});

return markdown;
Expand All @@ -73,10 +104,24 @@ function processConfigFiles() {
.filter(
(file) =>
file.endsWith('.ts') &&
!['index.ts', 'env-schema.ts', 'config.module.ts'].includes(file),
![
'index.ts',
'env-schema.ts',
'config.module.ts',
'cache-factory.config.ts',
'common-config.module.ts',
'gateway-config.service.ts',
'gateway-config.types.ts',
'params-decorators.ts',
'spec',
].includes(file),
);

let allEnvVarsWithComments: { comment: string; envVar: string }[] = [];
let allEnvVarsWithComments: {
comment: string;
envVar: string;
defaultValue?: string;
}[] = [];

files.forEach((file) => {
const filePath = path.join(CONFIG_FOLDER_PATH, file);
Expand Down
Loading