import AWS from 'aws-sdk' ; import { Config } from 'sequelize' ; import config from '../config' ; const rdsSigner = new AWS . RDS . Signer ( { region : config . get ( 'aws.awsRegion' ) , } ) ; export type MutableConfig = { - readonly [ K in keyof Config ] : Config [ K ] ; } ; param config export const generateRdsIamAuthToken = async ( config ) : Promise < string > => { const { username , port , host } = config ; return new Promise ( ( resolve , reject ) => { rdsSigner . getAuthToken ( { hostname : host , port : port ? + port : 5432 , username , } , ( err , token ) => { if ( err ) return reject ( err ) ; resolve ( token ) ; } ) ; } ) ; } ;