PHP: implemented "targets" option.

This allows to specify multiple subsequent targets inside PHP applications.
For example:

  {
      "listeners": {
          "*:80": {
              "pass": "routes"
          }
      },

      "routes": [
          {
              "match": {
                  "uri": "/info"
              },

              "action": {
                  "pass": "applications/my_app/phpinfo"
              }
          },
          {
              "match": {
                  "uri": "/hello"
              },

              "action": {
                  "pass": "applications/my_app/hello"
              }
          },
          {
              "action": {
                  "pass": "applications/my_app/rest"
              }
          }
      ],

      "applications": {
          "my_app": {
              "type": "php",
              "targets": {
                  "phpinfo": {
                      "script": "phpinfo.php",
                      "root": "/www/data/admin",
                  },

                  "hello": {
                      "script": "hello.php",
                      "root": "/www/data/test",
                  },

                  "rest": {
                      "root": "/www/data/example.com",
                      "index": "index.php"
                  },
              }
          }
      }
  }
This commit is contained in:
Valentin Bartenev
2020-05-14 13:15:01 +03:00
parent 0174c971b5
commit 376d758dd7
11 changed files with 515 additions and 266 deletions

View File

@@ -54,9 +54,7 @@ typedef struct {
typedef struct {
char *root;
nxt_str_t script;
nxt_str_t index;
nxt_conf_value_t *targets;
nxt_conf_value_t *options;
} nxt_php_app_conf_t;
@@ -101,6 +99,8 @@ struct nxt_common_app_conf_s {
nxt_ruby_app_conf_t ruby;
nxt_java_app_conf_t java;
} u;
nxt_conf_value_t *self;
};