@@ -39,14 +39,23 @@ export const run: <R2 = never>(
3939 const mysqlDump = ( args : Array < string > ) =>
4040 Effect . gen ( function * ( ) {
4141 const sql = yield * MysqlClient
42+
43+ const url = sql . config . url ? new URL ( Redacted . value ( sql . config . url ) ) : undefined
44+
45+ const host = url ?. hostname ?? sql . config . host
46+ const port = url ?. port ?? sql . config . port ?. toString ( )
47+ const username = url ?. username ?? sql . config . username
48+ const password = url ?. password ? Redacted . make ( url . password ) : sql . config . password
49+ const database = url ?. pathname ?. slice ( 1 ) ?? sql . config . database
50+
4251 const dump = yield * pipe (
4352 Command . make (
4453 "mysqldump" ,
45- ...( sql . config . host ? [ "-h" , sql . config . host ] : [ ] ) ,
46- ...( sql . config . port ? [ "-P" , sql . config . port . toString ( ) ] : [ ] ) ,
47- ...( sql . config . username ? [ "-u" , sql . config . username ] : [ ] ) ,
48- ...( sql . config . password ? [ `-p${ Redacted . value ( sql . config . password ) } ` ] : [ ] ) ,
49- ...( sql . config . database ? [ sql . config . database ] : [ ] ) ,
54+ ...( host ? [ "-h" , host ] : [ ] ) ,
55+ ...( port ? [ "-P" , port ] : [ ] ) ,
56+ ...( username ? [ "-u" , username ] : [ ] ) ,
57+ ...( password ? [ `-p${ Redacted . value ( password ) } ` ] : [ ] ) ,
58+ ...( database ? [ database ] : [ ] ) ,
5059 "--skip-comments" ,
5160 "--compact" ,
5261 ...args
0 commit comments