从@abearxiong/config拷贝过来
This commit is contained in:
		
							
								
								
									
										87
									
								
								config/app-schema.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								config/app-schema.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
{
 | 
			
		||||
  "$schema": "http://json-schema.org/draft-07/schema#",
 | 
			
		||||
  "title": "App Configuration Schema",
 | 
			
		||||
  "type": "object",
 | 
			
		||||
  "properties": {
 | 
			
		||||
    "type": {
 | 
			
		||||
      "type": "string",
 | 
			
		||||
      "enum": [
 | 
			
		||||
        "inline-app",
 | 
			
		||||
        "micro-app"
 | 
			
		||||
      ],
 | 
			
		||||
      "$comment": "Type must be either 'inline-app' or 'micro-app'"
 | 
			
		||||
    },
 | 
			
		||||
    "single": {
 | 
			
		||||
      "type": "boolean",
 | 
			
		||||
      "$comment": "是否单例模式,独立启动服务。"
 | 
			
		||||
    },
 | 
			
		||||
    "port": {
 | 
			
		||||
      "type": "integer",
 | 
			
		||||
      "minimum": 0,
 | 
			
		||||
      "maximum": 65535,
 | 
			
		||||
      "$comment": "开发和单例启动服务的端口"
 | 
			
		||||
    },
 | 
			
		||||
    "remote": {
 | 
			
		||||
      "type": "object",
 | 
			
		||||
      "properties": {
 | 
			
		||||
        "host": {
 | 
			
		||||
          "type": "string",
 | 
			
		||||
          "format": "hostname"
 | 
			
		||||
        },
 | 
			
		||||
        "path": {
 | 
			
		||||
          "type": "string",
 | 
			
		||||
          "pattern": "^/.*"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "required": [
 | 
			
		||||
        "host",
 | 
			
		||||
        "path"
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "micro": {
 | 
			
		||||
      "type": "object",
 | 
			
		||||
      "properties": {
 | 
			
		||||
        "serve": {
 | 
			
		||||
          "type": "object",
 | 
			
		||||
          "properties": {
 | 
			
		||||
            "name": {
 | 
			
		||||
              "type": "string",
 | 
			
		||||
              "pattern": "^[a-z0-9-]+$",
 | 
			
		||||
              "$comment": "服务名称"
 | 
			
		||||
            },
 | 
			
		||||
            "port": {
 | 
			
		||||
              "type": "integer",
 | 
			
		||||
              "minimum": 0,
 | 
			
		||||
              "maximum": 65535,
 | 
			
		||||
              "$comment": "启动的服务端口"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          "required": []
 | 
			
		||||
        },
 | 
			
		||||
        "remote": {
 | 
			
		||||
          "type": "object",
 | 
			
		||||
          "properties": {
 | 
			
		||||
            "host": {
 | 
			
		||||
              "type": "string",
 | 
			
		||||
              "format": "hostname"
 | 
			
		||||
            },
 | 
			
		||||
            "port": {
 | 
			
		||||
              "type": "integer",
 | 
			
		||||
              "minimum": 0,
 | 
			
		||||
              "maximum": 65535,
 | 
			
		||||
              "$comment": "链接的远程地址的端口"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          "required": [
 | 
			
		||||
            "host",
 | 
			
		||||
            "port"
 | 
			
		||||
          ]
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "required": []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "required": [
 | 
			
		||||
    "type"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								config/demo/inline-app.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								config/demo/inline-app.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
{
 | 
			
		||||
  "$schema": "../schema.json",
 | 
			
		||||
  "app": {
 | 
			
		||||
    "type": "inline-app",
 | 
			
		||||
    "port": 14000,
 | 
			
		||||
    "remote": {
 | 
			
		||||
      "host": "localhost",
 | 
			
		||||
      "path": "/api/router"
 | 
			
		||||
    },
 | 
			
		||||
    "micro": {
 | 
			
		||||
      "name": "micro-app",
 | 
			
		||||
      "port": 3001
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								config/demo/micro-app.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								config/demo/micro-app.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
{
 | 
			
		||||
  "$schema": "../schema.json",
 | 
			
		||||
  "app": {
 | 
			
		||||
    "type": "micro-app",
 | 
			
		||||
    "port": 14000,
 | 
			
		||||
    "remote": {
 | 
			
		||||
      "host": "localhost",
 | 
			
		||||
      "path": "/api/router"
 | 
			
		||||
    },
 | 
			
		||||
    "micro": {
 | 
			
		||||
      "remote": {
 | 
			
		||||
        "host": "localhost",
 | 
			
		||||
        "port": 3001
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								config/schema.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								config/schema.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  "$schema": "http://json-schema.org/draft-07/schema#",
 | 
			
		||||
  "title": "Packages JSON Schema",
 | 
			
		||||
  "type": "object",
 | 
			
		||||
  "properties": {
 | 
			
		||||
    "app": {
 | 
			
		||||
      "$ref": "./app-schema.json"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "required": [
 | 
			
		||||
    "app"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user