feat: 配置了部分数据库内容
This commit is contained in:
+9
-9
@@ -11,7 +11,7 @@
|
|||||||
//["Options", "-SessionTicket"],
|
//["Options", "-SessionTicket"],
|
||||||
//["Options", "Compression"]
|
//["Options", "Compression"]
|
||||||
]
|
]
|
||||||
},
|
},*/
|
||||||
"listeners": [
|
"listeners": [
|
||||||
{
|
{
|
||||||
//address: Ip address,0.0.0.0 by default
|
//address: Ip address,0.0.0.0 by default
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"port": 80,
|
"port": 80,
|
||||||
//https: If true, use https for security,false by default
|
//https: If true, use https for security,false by default
|
||||||
"https": false
|
"https": false
|
||||||
},
|
} /*,
|
||||||
{
|
{
|
||||||
"address": "0.0.0.0",
|
"address": "0.0.0.0",
|
||||||
"port": 443,
|
"port": 443,
|
||||||
@@ -34,14 +34,14 @@
|
|||||||
"ssl_conf": [
|
"ssl_conf": [
|
||||||
//["MinProtocol", "TLSv1.3"]
|
//["MinProtocol", "TLSv1.3"]
|
||||||
]
|
]
|
||||||
}
|
}*/
|
||||||
],
|
],
|
||||||
"db_clients": [
|
"db_clients": [
|
||||||
{
|
{
|
||||||
//name: Name of the client,'default' by default
|
//name: Name of the client,'default' by default
|
||||||
"name": "default",
|
"name": "ouc_reminder_database",
|
||||||
//rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default
|
//rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default
|
||||||
"rdbms": "postgresql",
|
"rdbms": "mysql",
|
||||||
//filename: Sqlite3 db file name
|
//filename: Sqlite3 db file name
|
||||||
//"filename":"",
|
//"filename":"",
|
||||||
//host: Server address,localhost by default
|
//host: Server address,localhost by default
|
||||||
@@ -49,11 +49,11 @@
|
|||||||
//port: Server port, 5432 by default
|
//port: Server port, 5432 by default
|
||||||
"port": 5432,
|
"port": 5432,
|
||||||
//dbname: Database name
|
//dbname: Database name
|
||||||
"dbname": "test",
|
"dbname": "ouc_reminder",
|
||||||
//user: 'postgres' by default
|
//user: 'postgres' by default
|
||||||
"user": "",
|
"user": "pjh123",
|
||||||
//passwd: '' by default
|
//passwd: '' by default
|
||||||
"passwd": "",
|
"passwd": "123456",
|
||||||
//is_fast: false by default, if it is true, the client is faster but user can't call
|
//is_fast: false by default, if it is true, the client is faster but user can't call
|
||||||
//any synchronous interface of it.
|
//any synchronous interface of it.
|
||||||
"is_fast": false,
|
"is_fast": false,
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
//For more information, see https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-OPTIONS
|
//For more information, see https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-OPTIONS
|
||||||
//"connect_options": { "statement_timeout": "1s" }
|
//"connect_options": { "statement_timeout": "1s" }
|
||||||
}
|
}
|
||||||
],
|
], /*
|
||||||
"redis_clients": [
|
"redis_clients": [
|
||||||
{
|
{
|
||||||
//name: Name of the client,'default' by default
|
//name: Name of the client,'default' by default
|
||||||
|
|||||||
+8
-4
@@ -24,7 +24,8 @@
|
|||||||
//after it is read from database
|
//after it is read from database
|
||||||
"convert": {
|
"convert": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"items":[{
|
"items": [
|
||||||
|
{
|
||||||
"table": "user",
|
"table": "user",
|
||||||
"column": "password",
|
"column": "password",
|
||||||
"method": {
|
"method": {
|
||||||
@@ -34,13 +35,16 @@
|
|||||||
"before_db_write": "encrypt_password"
|
"before_db_write": "encrypt_password"
|
||||||
},
|
},
|
||||||
"includes": [
|
"includes": [
|
||||||
"\"file_local_search_path.h\"","<file_in_global_search_path.h>"
|
"\"file_local_search_path.h\"",
|
||||||
|
"<file_in_global_search_path.h>"
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
"relationships": {
|
"relationships": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"items": [{
|
"items": [
|
||||||
|
{
|
||||||
"type": "has one",
|
"type": "has one",
|
||||||
"original_table_name": "products",
|
"original_table_name": "products",
|
||||||
"original_table_alias": "product",
|
"original_table_alias": "product",
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
{
|
||||||
|
//rdbms: server type, postgresql,mysql or sqlite3
|
||||||
|
"rdbms": "postgresql",
|
||||||
|
//filename: sqlite3 db file name
|
||||||
|
//"filename":"",
|
||||||
|
//host: server address,localhost by default;
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
//port: server port, 5432 by default;
|
||||||
|
"port": 5432,
|
||||||
|
//dbname: Database name;
|
||||||
|
"dbname": "mysql",
|
||||||
|
//schema: valid for postgreSQL, "public" by default;
|
||||||
|
"schema": "public",
|
||||||
|
//user: User name
|
||||||
|
"user": "pjh123",
|
||||||
|
//password or passwd: Password
|
||||||
|
"password": "123456",
|
||||||
|
//client_encoding: The character set used by drogon_ctl. it is empty string by default which
|
||||||
|
//means use the default character set.
|
||||||
|
//"client_encoding": "",
|
||||||
|
//table: An array of tables to be modelized. if the array is empty, all revealed tables are modelized.
|
||||||
|
"tables": [],
|
||||||
|
//convert: the value can be changed by a function call before it is stored into database or
|
||||||
|
//after it is read from database
|
||||||
|
"convert": {
|
||||||
|
"enabled": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"table": "user",
|
||||||
|
"column": "password",
|
||||||
|
"method": {
|
||||||
|
//after_db_read: name of the method which is called after reading from database, signature: void([const] std::shared_ptr [&])
|
||||||
|
"after_db_read": "decrypt_password",
|
||||||
|
//before_db_write: name of the method which is called before writing to database, signature: void([const] std::shared_ptr [&])
|
||||||
|
"before_db_write": "encrypt_password"
|
||||||
|
},
|
||||||
|
"includes": [
|
||||||
|
"\"file_local_search_path.h\"",
|
||||||
|
"<file_in_global_search_path.h>"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"relationships": {
|
||||||
|
"enabled": false,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "has one",
|
||||||
|
"original_table_name": "products",
|
||||||
|
"original_table_alias": "product",
|
||||||
|
"original_key": "id",
|
||||||
|
"target_table_name": "skus",
|
||||||
|
"target_table_alias": "SKU",
|
||||||
|
"target_key": "product_id",
|
||||||
|
"enable_reverse": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "has many",
|
||||||
|
"original_table_name": "products",
|
||||||
|
"original_table_alias": "product",
|
||||||
|
"original_key": "id",
|
||||||
|
"target_table_name": "reviews",
|
||||||
|
"target_table_alias": "",
|
||||||
|
"target_key": "product_id",
|
||||||
|
"enable_reverse": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "many to many",
|
||||||
|
"original_table_name": "products",
|
||||||
|
"original_table_alias": "",
|
||||||
|
"original_key": "id",
|
||||||
|
"pivot_table": {
|
||||||
|
"table_name": "carts_products",
|
||||||
|
"original_key": "product_id",
|
||||||
|
"target_key": "cart_id"
|
||||||
|
},
|
||||||
|
"target_table_name": "carts",
|
||||||
|
"target_table_alias": "",
|
||||||
|
"target_key": "id",
|
||||||
|
"enable_reverse": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restful_api_controllers": {
|
||||||
|
"enabled": false,
|
||||||
|
// resource_uri: The URI to access the resource, the default value
|
||||||
|
// is '/*' in which the asterisk represents the table name.
|
||||||
|
// If this option is set to a empty string, the URI is composed of the namespaces and the class name.
|
||||||
|
"resource_uri": "/*",
|
||||||
|
// class_name: "Restful*Ctrl" by default, the asterisk represents the table name.
|
||||||
|
// This option can contain namespaces.
|
||||||
|
"class_name": "Restful*Ctrl",
|
||||||
|
// filters: an array of filter names.
|
||||||
|
"filters": [],
|
||||||
|
// db_client: the database client used by the controller. this option must be consistent with
|
||||||
|
// the configuration of the application.
|
||||||
|
"db_client": {
|
||||||
|
//name: Name of the client,'default' by default
|
||||||
|
"name": "default",
|
||||||
|
//is_fast:
|
||||||
|
"is_fast": false
|
||||||
|
},
|
||||||
|
// directory: The directory where the controller source files are stored.
|
||||||
|
"directory": "controllers",
|
||||||
|
// generate_base_only: false by default. Set to true to avoid overwriting custom subclasses.
|
||||||
|
"generate_base_only": false
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user