UNPKG

app.json

Version:

Create, validate, and render Heroku app.json manifests

111 lines (105 loc) 4.84 kB
"use strict" var schema = { "properties": { "name": { "description": "A clean and simple name to identify the template (30 characters max).", "type": "string", "minLength": 3, "maxLength": 30, "allowEmpty": false, "example": "Small Sharp Tool" }, "description": { "description": "A brief summary of the app: what it does, who it's for, why it exists, etc.", "type": "string", "example": "This app does one little thing, and does it well.", "maxLength": 140 }, "keywords": { "description": "An array of strings describing the app.", "type": "array", "example": ["productivity", "HTML5", "scalpel"] }, "website": { "description": "The project's website.", "type": "string", "format": "url", "allowEmpty": false, "example": "https://small-sharp-tool.com/" }, "repository": { "description": "The location of the application's source code, such as a Git URL, GitHub URL, Subversion URL, or Mercurial URL.", "type": "string", "format": "url", "allowEmpty": false, "example": "https://github.com/jane-doe/small-sharp-tool" }, "logo": { "description": "The URL of the application's logo image. Dimensions should be square. Format can be SVG, PNG, or JPG.", "type": "string", "format": "url", "allowEmpty": false, "example": "https://small-sharp-tool.com/logo.svg" }, "success_url": { "description": "A URL specifying where to redirect the user once their new app is deployed. If value is a fully-qualified URL, the user should be redirected to that URL. If value begins with a slash `/`, the user should be redirected to that path in their newly deployed app.", "type": "string", "allowEmpty": false, "example": "/welcome" }, "scripts": { "description": "A key-value object specifying scripts or shell commands to execute at different stages in the build/release process. Currently, `postdeploy` is the only supported script.", "type": "object", "example": {"postdeploy": "bundle exec rake bootstrap"} }, "env": { "description": "A key-value object for environment variables, or [config vars](https://devcenter.heroku.com/articles/config-vars) in Heroku parlance. Keys are the names of the environment variables. Values can be strings or objects. If the value is a string, it will be used. If the value is an object, it defines specific requirements for that variable:\n\n- `description`: a human-friendly blurb about what the value is for and how to determine what it should be\n- `value`: a default value to use. This should always be a string.\n- `required`: A boolean indicating whether the given value is required for the app to function (default: `true`).\n- `generator`: a string representing a function to call to generate the value. Currently the only supported generator is `secret`, which generates a pseudo-random string of characters.", "type": "object", "example": { "BUILDPACK_URL": "https://github.com/stomita/heroku-buildpack-phantomjs", "SECRET_TOKEN": { "description": "A secret key for verifying the integrity of signed cookies.", "generator": "secret" }, "WEB_CONCURRENCY": { "description": "The number of processes to run.", "value": "5" } } }, "addons": { "description": "An array of strings specifying Heroku addons to provision on the app before deploying. Each addon should be in the format `addon:plan` or `addon`. If plan is omitted, that addon's default plan will be provisioned.", "type": "array", "example": [ "openredis", "mongolab:shared-single-small" ] }, "formation": { "description": "An array of objects specifying dynos to scale on the app before deploying.", "type": "array", "example": [ { "process": "web", "quantity": 1, "size": "standard-2X" }, { "process": "worker", "quantity": 1, "size": "standard-2X" } ] } } } // Assemble an example schema schema.example = {} Object.keys(schema.properties).map(function(key){ schema.example[key] = schema.properties[key].example }) // Assemble a template-ready stringified version of the schema schema.exampleJSON = JSON.stringify(schema.example, null, 2) // Coerce schema properties into a template-friendly format schema.propertiesArray = Object.keys(schema.properties).map(function(name) { var prop = schema.properties[name] prop.name = name prop.requiredOrOptional = prop.required ? "required" : "optional" var jsonDoc = {} jsonDoc[prop.name] = prop.example prop.exampleJSON = JSON.stringify(jsonDoc, null, 2) return prop }) module.exports = schema