Configuration

 

Genelet uses JSON files to define site and object properties. The website-level properties are defined in config.json under conf or WEB-INF, including variable names, database settings, loggings,  template locations and error codes etc. Genelet handles API, authentication and email etc. internally, also by definitions in config.json.

For each request, Genelet will dispatch it to an individual object (or component) to process. The component consists of a Model class, a Controller class and few views, which are initialized by another JSON file component.json. Please check Manual for how to program object’s MVC.

 

CONTENTS:

  1. General Properties
    1. URL 
    2. Names and Variabes
    3. Database Access
    4. Templates
    5. REST Verbs
    6. Error Codes
    7. Logging
  2. Mime Types
    1. HTML Types
    2. JSON
    3. JSONP
    4. XML
  3. Authentication & Authorization
    1. Roles and Gates
    2. Login and Issuers
    3. Issuer plain
    4. Issuer db
    5. OAuth
    6. Logout
  4. URL Handling 
    1. Protect Static Content
    2. Rerouting
    3. Caching
  5. Tasks
    1. CORS
    2. File Uploading
    3. Sending Email
    4. Apple Push Notification
    5. Google Cloud Message
    6. Sending SMS

 

Example

If you run the help command, a simple config.json will be generated. It looks like this:

{
  "Document_root": "/home/user1/myproject/www",
  "Project_name": "myproject",
  "Script_name": "/verson01",
  "Template": "/home/user1/myproject/views",
  "Uploaddir": "/home/user1/myproject/views/videos",
  "Pubrole": "public",
  "Secret":"aaaaaaaaaa111111111",
  "Chartags": {
    "html": {
      "Content_type": "text/html; charset=UTF-8",
      "Short": "html"
    },
    "json": {
      "Content_type": "application/json; charset=UTF-8",
      "Short": "json",
      "Challenge": "challenge",
      "Logged": "logged",
      "Logout": "logout",
      "Failed": "failed",
      "Case": 1
    }
  },
  "Db": ["mysql", "dbuser:1234@/dbname"],
  "Roles": {        
    "admin" : {
      "Id_name" : "login",
      "Is_admin" : true,
      "Attributes" : ["login","provider"],
      "Type_id" : 1,
      "Surface" : "cadmin",
      "Duration" : 86400,
      "Max_age"  : 86400,
      "Secret" : "aaaaaaaaaabbbbb",
      "Coding" : "111111111111222",
      "Logout" : "/",
      "Issuers" : {
        "plain" : {
          "Drfault" : true,
          "Credential" : ["login", "passwd"],
          "Provider_pars": {"Def_login":"hello", "Def_password":"world"}
        }
      }
    }
  }
}

 

Continue on General Properties