@@ -4,6 +4,7 @@ import 'dotenv/config'
44import { Transloadit as TransloaditClient } from '../../Transloadit.ts'
55import type { IOutputCtl } from '../OutputCtl.ts'
66import OutputCtl , { LOG_LEVEL_DEFAULT , LOG_LEVEL_NAMES , parseLogLevel } from '../OutputCtl.ts'
7+ import { getEnvCredentials } from '../helpers.ts'
78
89export abstract class BaseCommand extends Command {
910 logLevelOption = Option . String ( '-l,--log-level' , {
@@ -31,7 +32,8 @@ export abstract class BaseCommand extends Command {
3132 }
3233
3334 protected setupClient ( ) : boolean {
34- if ( ! process . env . TRANSLOADIT_KEY || ! process . env . TRANSLOADIT_SECRET ) {
35+ const creds = getEnvCredentials ( )
36+ if ( ! creds ) {
3537 this . output . error (
3638 'Please provide API authentication in the environment variables TRANSLOADIT_KEY and TRANSLOADIT_SECRET' ,
3739 )
@@ -40,11 +42,7 @@ export abstract class BaseCommand extends Command {
4042
4143 const endpoint = this . endpoint || process . env . TRANSLOADIT_ENDPOINT
4244
43- this . client = new TransloaditClient ( {
44- authKey : process . env . TRANSLOADIT_KEY ,
45- authSecret : process . env . TRANSLOADIT_SECRET ,
46- ...( endpoint && { endpoint } ) ,
47- } )
45+ this . client = new TransloaditClient ( { ...creds , ...( endpoint && { endpoint } ) } )
4846 return true
4947 }
5048
0 commit comments