Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy/lib/createFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module.exports = {
params.runtime = this.validateRuntime(func, availableRuntimes, this.serverless.cli);

// checking if there is custom_domains set on function creation.
if (func.custom_domains.length > 0) {
if (func.custom_domains && func.custom_domains.length > 0) {
this.serverless.cli.log("WARNING: custom_domains are available on function update only. "+
"Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/")
}
Expand Down
6 changes: 4 additions & 2 deletions info/lib/display.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";

const yaml = require('js-yaml');

module.exports = {
displayInfo() {
const configInput = this.serverless.configurationInput;
Expand All @@ -17,13 +19,13 @@ module.exports = {
) {
this.listContainers(namespace.id).then((containers) => {
containers.forEach((container) => {
this.serverless.cli.log(JSON.stringify(container, null, "\t"));
this.serverless.cli.log(yaml.dump(container));
});
});
} else {
this.listFunctions(namespace.id).then((functions) => {
functions.forEach((func) => {
this.serverless.cli.log(JSON.stringify(func, null, "\t"));
this.serverless.cli.log(yaml.dump(func));
});
});
}
Expand Down
26 changes: 20 additions & 6 deletions provider/scalewayProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,36 @@ class ScalewayProvider {
}

setCredentials(options) {
// On serverless info command we do not want log pollution from authentication.
// This is necessary to use it in automated environment.
let hideLog = false;
if (this.serverless.configurationInput.service && this.serverless.configurationInput.service === 'serverlessInfo') {
hideLog = true;
}
if (options['scw-token'] && options['scw-project']) {
this.serverless.cli.log('Using credentials from command line parameters');
if (!hideLog) {
this.serverless.cli.log('Using credentials from command line parameters');
}
this.scwToken = options['scw-token'];
this.scwProject = options['scw-project'];
} else if (process.env.SCW_SECRET_KEY && process.env.SCW_DEFAULT_PROJECT_ID) {
this.serverless.cli.log('Using credentials from system environment');
if (!hideLog) {
this.serverless.cli.log('Using credentials from system environment');
}
this.scwToken = process.env.SCW_SECRET_KEY;
this.scwProject = process.env.SCW_DEFAULT_PROJECT_ID;
} else if (process.env.SCW_TOKEN && process.env.SCW_PROJECT) {
this.serverless.cli.log('Using credentials from system environment');
this.serverless.cli.log('NOTICE: you are using deprecated environment variable notation,');
this.serverless.cli.log('please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID');
if (!hideLog) {
this.serverless.cli.log('Using credentials from system environment');
this.serverless.cli.log('NOTICE: you are using deprecated environment variable notation,');
this.serverless.cli.log('please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID');
}
this.scwToken = process.env.SCW_TOKEN;
this.scwProject = process.env.SCW_PROJECT;
} else {
this.serverless.cli.log('Using credentials from yml');
if (!hideLog) {
this.serverless.cli.log('Using credentials from yml');
}
this.scwToken = this.serverless.service.provider.scwToken || '';
this.scwProject = this.serverless.service.provider.scwProject || '';
}
Expand Down