Table Of Contents

Web Environment

Web Environment type

A resource of the “WebEnvironment” type represents a folder with files. Files and folders of the website must be accessible over the HTTP protocol on a domain.

The WebEnvironment type schema: download

{
   "apsVersion": "2.0",

   "name": "WebEnvironment",

   "id": "http://aps-standard.org/types/infrastructure/environment/web/1.0",
   "implements": [ "http://aps-standard.org/types/infrastructure/environment/1.0" ],

   "properties": {
      "path": {
         "type": "string",
         "required": false
      },
      "urls": {
        "type": "array",
        "required": true,
        "items": { "type": "string" },
        "minItems": 1
      },
      "root": {
        "type": "string",
        "default": "htdocs"
      },
      "directories": {
        "type": "array",
        "items": { "type": "Directory" }
      }
   },
   
   "structures": {
     "Directory": {
       "type": "object",
       "properties":  {         
          "path": { "type": "string", "required": true },
          "handlers": {
            "type": "array",
            "items": { "type": "Handler" }
          }
       }
     },
     "Handler": {
       "type": "object",
       "properties": {
          "engine":  { "type": "string"  },
          "enabled": { "type": "boolean" },
          "extensions": {
              "type": "array",
              "items": { "type": "string" }
          }
       }
     }
   }
}

The properties have to be filled with the following data:

Property

Description

path

Path on the local file system to the folder with website files and directories. Filled by the environment resource.

urls

List of access URLs for the website (actual in case of HTTP/HTTPS access or if the site have several aliases). As a minimum one item must be in the list. The first item of the list is considered to be the primary address. Filled by the environment resource.

root

Folder in an APS package, which will be mapped to the root folder of the HTTP website which exposes the application. Defaults to htdocs unless something other specified by the application.

directories

Properties applied to directories, see details at Web Directories Properties.

A typical web environment resource will look like:

{
    "aps": {
        "type": "http://aps-standard.org/types/infrastructure/environment/web/1.0",
        "id": "ba81a90d-53b7-4985-8e3f-05404435d7a5"
    },

    "path": "/var/www/vhosts/webspaces/12345678/siteapps/wordpress",
    "urls": [
                "http://mysite.com/wordpress",
                "https://mysite.com/wordpress",
                "http://mysite.com:8080/wordpress",
                "http://alias.my.site.com/wordpress"
            ],
    "root": "htdocs"
 }

Web Directories Properties

The application author can define properties for different directories of the application, see type Handler in Web Environment schema.

{
    "directories": [
        {
            "path": "/",
            "handlers": [ { "engine": "php", "enabled": true, "extensions": [ ".php", ".phtml" ] } ]
        },
        {
            "path": "/uploads",
            "handlers": [ { "engine": "php", "enabled": false } ]
        }
    ]
 }

A path element defines to which directories the rule is applied. The path is calculated from the root folder (see above). A handlers element defines for the directory an array with handlers and their properties.

Directories are applied with a rule “most specific wins”, that is in the example above /uploads will have the php handler disabled. Various engines may be supplied by appropriate engine interfaces, see below.

Require PHP interpreter

To enable a php interpreter in the web environment, one may require it in the engines list of the environment. Below is an example of type definition for a php web application which requires the web environment.

{
  "id": "http://aps-standard.org/something/1.0",
  ...
  "properties": {
     "admin_name" : {
         "type": "string",
         "required": true,

     },
     ...
  },
  "relations": {
     "webenv": {
         "type": "http://aps-standard.org/types/infrastructure/environment/web/1.0",
         "requirement": "'php' in engines and php.version >= 5.0",
         "required": true,
         "assign": {
             "root": "htdocs",
             "directories": [
                 {
                   "path": "/",
                   "handlers": [ { "engine": "php" } ]
                 }
             ]
         }
     }
   }
 }