• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 11233174198

08 Oct 2024 10:05AM UTC coverage: 46.725% (-44.0%) from 90.725%
11233174198

push

github

web-flow
Increase relay rate limit TTL (#1971)

Increases the relay rate limit TTL fallback value to 24 hours:

- Change `relay.ttlSeconds` value to `60 * 60 * 24`

498 of 3105 branches covered (16.04%)

Branch coverage included in aggregate %.

5024 of 8713 relevant lines covered (57.66%)

12.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.62
/src/datasources/db/postgres-database.module.ts
1
import postgres from 'postgres';
16✔
2
import { Module } from '@nestjs/common';
16✔
3
import { PostgresDatabaseShutdownHook } from '@/datasources/db/postgres-database.shutdown.hook';
16✔
4
import { IConfigurationService } from '@/config/configuration.service.interface';
16✔
5
import { PostgresDatabaseMigrationHook } from '@/datasources/db/postgres-database.migration.hook';
16✔
6
import fs from 'fs';
16✔
7
import { PostgresDatabaseMigrator } from '@/datasources/db/postgres-database.migrator';
16✔
8
import { ICachedQueryResolver } from '@/datasources/db/cached-query-resolver.interface';
16✔
9
import { CachedQueryResolver } from '@/datasources/db/cached-query-resolver';
16✔
10

11
function dbFactory(configurationService: IConfigurationService): postgres.Sql {
12
  const caPath = configurationService.get<string>('db.postgres.ssl.caPath');
×
13
  const ca: string | undefined =
14
    caPath && caPath.length > 0 ? fs.readFileSync(caPath, 'utf8') : undefined;
×
15

16
  const sslConfig = configurationService.getOrThrow('db.postgres.ssl.enabled')
×
17
    ? {
18
        requestCert: configurationService.getOrThrow(
19
          'db.postgres.ssl.requestCert',
20
        ),
21
        rejectUnauthorized: configurationService.getOrThrow(
22
          'db.postgres.ssl.rejectUnauthorized',
23
        ),
24
        ca,
25
      }
26
    : false;
27
  return postgres({
×
28
    host: configurationService.getOrThrow('db.postgres.host'),
29
    port: configurationService.getOrThrow('db.postgres.port'),
30
    db: configurationService.getOrThrow('db.postgres.database'),
31
    user: configurationService.getOrThrow('db.postgres.username'),
32
    password: configurationService.getOrThrow('db.postgres.password'),
33
    ssl: sslConfig,
34
  });
35
}
36

37
function migratorFactory(sql: postgres.Sql): PostgresDatabaseMigrator {
38
  return new PostgresDatabaseMigrator(sql);
×
39
}
40

41
@Module({
42
  providers: [
43
    {
44
      provide: 'DB_INSTANCE',
45
      useFactory: dbFactory,
46
      inject: [IConfigurationService],
47
    },
48
    {
49
      provide: PostgresDatabaseMigrator,
50
      useFactory: migratorFactory,
51
      inject: ['DB_INSTANCE'],
52
    },
53
    {
54
      provide: ICachedQueryResolver,
55
      useClass: CachedQueryResolver,
56
    },
57
    PostgresDatabaseShutdownHook,
58
    PostgresDatabaseMigrationHook,
59
  ],
60
  exports: ['DB_INSTANCE', ICachedQueryResolver],
61
})
62
export class PostgresDatabaseModule {}
16✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc