Skip to content
龙方淞 edited this page Aug 31, 2020 · 4 revisions

Configuration is used to tell the program how to generate the Web API.

Configuration items

The supported configuration items are:

  • docker: Information for generating Dockerfile and related CI files. Dockerfile will not be generated if not provided
    • username: Docker Usernam
    • tag: tag of the image
  • cicd: Information for generating CICD-related configuration files
    • GitHubAction: Whether to generate a GitHub Action configuation file
    • k8s: Whether to generate k8s configuation file
  • database: database related information, required
    • dbengine: The database engine to use, pgsql by default
    • url: database url, cannot create k8s configuation file if not provided, will panic if so
    • tablename: tablename in the database
    • fields: fields in the database, will try to fetch from the meta table in the database implied by url
      • name: field name
      • type: field type (use the typename in the database)
    • complex: complex query
      • name: API endpoint of the complex query
      • sql: sql used during the query
      • params: params used in the qurty
        • onThis: The foreign key name on the original table, give name or this field
        • name: field name, give this field or onThis
        • type: field type
      • result: return value of this API
        • array: whether return multiple results
        • fields: colums in the database
          • name: field name
          • type: field type (use the typename in the database)

Source of the configuration

The system supports the following ways to accept configuration:

  • Command line parameters
  • environment variable
  • yaml/toml/json file
  • .sql file
  • Database meta information
  • default value

The priority decreases from top to bottom, for example:

  • If you provide -databaseurl=xxx in the command line, the corresponding database.url in yaml will be ignored
  • If you do not provide database.fields in the input yaml file, the program will try to connect to the database database.url to read the metadata in the database to generate fields information.

You can export the final configuration to a file.

Clone this wiki locally