@@ -38,22 +38,36 @@ class ScalewayProvider {
3838 }
3939
4040 setCredentials ( options ) {
41+ // On serverless info command we do not want log pollution from authentication.
42+ // This is necessary to use it in automated environment.
43+ let hideLog = false ;
44+ if ( this . serverless . configurationInput . service && this . serverless . configurationInput . service === 'serverlessInfo' ) {
45+ hideLog = true ;
46+ }
4147 if ( options [ 'scw-token' ] && options [ 'scw-project' ] ) {
42- this . serverless . cli . log ( 'Using credentials from command line parameters' ) ;
48+ if ( ! hideLog ) {
49+ this . serverless . cli . log ( 'Using credentials from command line parameters' ) ;
50+ }
4351 this . scwToken = options [ 'scw-token' ] ;
4452 this . scwProject = options [ 'scw-project' ] ;
4553 } else if ( process . env . SCW_SECRET_KEY && process . env . SCW_DEFAULT_PROJECT_ID ) {
46- this . serverless . cli . log ( 'Using credentials from system environment' ) ;
54+ if ( ! hideLog ) {
55+ this . serverless . cli . log ( 'Using credentials from system environment' ) ;
56+ }
4757 this . scwToken = process . env . SCW_SECRET_KEY ;
4858 this . scwProject = process . env . SCW_DEFAULT_PROJECT_ID ;
4959 } else if ( process . env . SCW_TOKEN && process . env . SCW_PROJECT ) {
50- this . serverless . cli . log ( 'Using credentials from system environment' ) ;
51- this . serverless . cli . log ( 'NOTICE: you are using deprecated environment variable notation,' ) ;
52- this . serverless . cli . log ( 'please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID' ) ;
60+ if ( ! hideLog ) {
61+ this . serverless . cli . log ( 'Using credentials from system environment' ) ;
62+ this . serverless . cli . log ( 'NOTICE: you are using deprecated environment variable notation,' ) ;
63+ this . serverless . cli . log ( 'please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID' ) ;
64+ }
5365 this . scwToken = process . env . SCW_TOKEN ;
5466 this . scwProject = process . env . SCW_PROJECT ;
5567 } else {
56- this . serverless . cli . log ( 'Using credentials from yml' ) ;
68+ if ( ! hideLog ) {
69+ this . serverless . cli . log ( 'Using credentials from yml' ) ;
70+ }
5771 this . scwToken = this . serverless . service . provider . scwToken || '' ;
5872 this . scwProject = this . serverless . service . provider . scwProject || '' ;
5973 }
0 commit comments