Commit b9c63b91 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Add logging for RDB_PASSWORD in LoadConfig and create new WAF tables

This update adds a log statement to the LoadConfig function to output the RDB_PASSWORD for better visibility during configuration loading. Additionally, it introduces new SQL tables for `waf_listener_histories` and `waf_blackwhitelists`, enhancing the database schema to support WAF functionalities.# Please enter the commit message for your changes. Lines starting
parent 4f40d578
......@@ -63,6 +63,7 @@ func LoadConfig() *Config {
return nil
}
password := os.Getenv("RDB_PASSWORD")
log.Info().Msgf("RDB_PASSWORD: %s", password)
if password != "" {
config.DBConfig.Password = password
}
......
......@@ -35,14 +35,44 @@ CREATE TABLE waf_rule_categories (
);
-- Create gateway_listeners table
CREATE TABLE gateway_listeners (
id SERIAL PRIMARY KEY,
gateway_name VARCHAR(255) NOT NULL,
namespace VARCHAR(255) NOT NULL,
region_code VARCHAR(50) NOT NULL,
port INTEGER NOT NULL,
enable BOOLEAN NOT NULL,
hosts TEXT
-- CREATE TABLE gateway_listeners (
-- id SERIAL PRIMARY KEY,
-- gateway_name VARCHAR(255) NOT NULL,
-- namespace VARCHAR(255) NOT NULL,
-- region_code VARCHAR(50) NOT NULL,
-- port INTEGER NOT NULL,
-- enable BOOLEAN NOT NULL,
-- hosts TEXT
-- );
CREATE TABLE `waf_listener_histories` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`name` varchar(255) DEFAULT NULL,
`gateway_name` varchar(255) DEFAULT NULL,
`listener_name` varchar(255) DEFAULT NULL,
`namespace` varchar(255) DEFAULT NULL,
`region_code` varchar(255) DEFAULT NULL,
`description` text DEFAULT NULL,
`status` int DEFAULT NULL,
`operation` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS waf_blackwhitelists
(
id bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(128) NOT NULL,
scope varchar(256) NOT NULL,
mode varchar(32),
expr varchar(512),
status smallint NOT NULL,
global boolean DEFAULT false,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY (name)
);
-- Add indexes for better query performance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment