Skip to content

Commit

Permalink
[release] Bump coordinator v2.0.7
Browse files Browse the repository at this point in the history
support special chars in postgres password
  • Loading branch information
icezohu authored Apr 12, 2024
2 parents 906d609 + 23a4089 commit 9cece83
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/indexer-coordinator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/indexer-coordinator",
"version": "2.0.7-1",
"version": "2.0.7",
"description": "",
"author": "SubQuery",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer-coordinator/src/payg/payg.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class PaygService {
// add a price every time
channel.spent = (prevSpent + price).toString();

logger.warn(`channel.spent: ${channel.spent}, spent: ${spent}, price: ${price}`);
logger.debug(`channel.spent: ${channel.spent}, spent: ${spent}, price: ${price}`);

// if remote is less than own, just add spent
if (prevRemote < currentRemote) {
Expand Down
12 changes: 10 additions & 2 deletions apps/indexer-coordinator/src/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import _ from 'lodash';
import { timeoutPromiseHO } from 'src/utils/promise';
import { PostgresKeys, argv } from 'src/yargs';
import { Not, Repository } from 'typeorm';
import { Config } from '../configure/configure.module';
import { Config, Postgres } from '../configure/configure.module';
import { AccountService } from '../core/account.service';
import { ContractService } from '../core/contract.service';
import { DockerService } from '../core/docker.service';
Expand Down Expand Up @@ -319,7 +319,7 @@ export class ProjectService {
const mmrStoreType = await this.getMmrStoreType(project.id);
const projectID = projectId(project.id);

const postgres = this.config.postgres;
const postgres = this.escapePostgresConfig(this.config.postgres);
const dockerNetwork = this.config.dockerNetwork;

const mmrPath = argv['mmrPath'].replace(/\/$/, '');
Expand Down Expand Up @@ -349,6 +349,14 @@ export class ProjectService {
return item;
}

escapePostgresConfig(config: Postgres) {
const escaped = JSON.parse(JSON.stringify(config)) as Postgres;
escaped.user = escaped.user.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
escaped.pass = escaped.pass.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
escaped.db = escaped.db.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
return escaped;
}

async createAndStartSubqueryProject(id: string, projectConfig: IProjectConfig) {
let project = await this.getProject(id);
if (!project) {
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer-coordinator/src/project/rpc.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class RpcFamilyEvm extends RpcFamily {
this.actions.push(async () => {
const result = await jsonRpcRequest(this.endpoint, 'eth_getBalance', [
'0x0000000000000000000000000000000000000000',
'latest',
'0x1',
]);
let nodeTypeFromRpc: string;
if (result.data.error) {
Expand Down
12 changes: 6 additions & 6 deletions apps/indexer-coordinator/src/utils/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ services:
expose:
- {{servicePort}}
environment:
DB_USER: {{postgres.user}}
DB_PASS: {{postgres.pass}}
DB_DATABASE: {{postgres.db}}
DB_USER: "{{postgres.user}}"
DB_PASS: "{{postgres.pass}}"
DB_DATABASE: "{{postgres.db}}"
DB_HOST: {{postgres.host}}
DB_PORT: {{postgres.port}}
volumes:
Expand Down Expand Up @@ -73,9 +73,9 @@ services:
condition: service_healthy
restart: always
environment:
DB_USER: {{postgres.user}}
DB_PASS: {{postgres.pass}}
DB_DATABASE: {{postgres.db}}
DB_USER: "{{postgres.user}}"
DB_PASS: "{{postgres.pass}}"
DB_DATABASE: "{{postgres.db}}"
DB_HOST: {{postgres.host}}
DB_PORT: {{postgres.port}}
command:
Expand Down

0 comments on commit 9cece83

Please sign in to comment.