Sha256: d7d44652bb9174861732837bf8b54a34cf7b73995cb8817105e707e36c219937

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

const path = require("path")
const optimist = require('optimist')
const yaml = require("yaml-boost")

const config = yaml.load(path.join(__dirname, "config/serverless.yml"), optimist.argv)
const stage = optimist.argv.stage ? optimist.argv.stage : "dev"

const layerName = config.service.charAt(0).toUpperCase() + config.service.slice(1) + stage.charAt(0).toUpperCase() + stage.slice(1)
const layerStackName = config.service + "-layer-" + stage

let targetConfig

if(optimist.argv["stack"] == "layer") {
  let layers = {}

  layers[layerName] = {
    path: "layer",
    description: "Ruby project layer",
    compatibleRuntimes: ["ruby2.5"]
  }
  delete config.provider.environment

  targetConfig = {
    service: config.service + "-layer",
    provider: config.provider,
    layers: layers,
    package: {
      include: ["layer/**"]
    }
  }

} else {
  let layerArn = `\${cf:${layerStackName}.` + `${layerName}LambdaLayerQualifiedArn}`.replace(/-/g, 'Dash')

  if(config.custom) {
    config.custom["layerArn"] = layerArn
  } else {
    config.custom = {
      layerArn: layerArn
    }
  }

  targetConfig = config
}

if(process.env.CI){
  if(targetConfig.custom) {
    delete targetConfig.custom.settings
  }
} else {
  targetConfig.provider["profile"] = "devhub-" + stage
}

module.exports = targetConfig

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
serverless_hub-1.1.1 lib/serverless_hub/templates/serverless.js
m_serverless_hub-0.0.1 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.10 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.9 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.8 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.7 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.6 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.5 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.4 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.3 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.2 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.1 lib/serverless_hub/templates/serverless.js
serverless_hub-1.0.0 lib/serverless_hub/templates/serverless.js