frontend/service_config/
mysql.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use serde::{Deserialize, Serialize};
16use servers::tls::TlsOption;
17
18#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
19pub struct MysqlOptions {
20    pub enable: bool,
21    pub addr: String,
22    pub runtime_size: usize,
23    #[serde(default = "Default::default")]
24    pub tls: TlsOption,
25    pub reject_no_database: Option<bool>,
26    /// Server-side keep-alive time.
27    ///
28    /// Set to 0 (default) to disable.
29    #[serde(default = "Default::default")]
30    #[serde(with = "humantime_serde")]
31    pub keep_alive: std::time::Duration,
32}
33
34impl Default for MysqlOptions {
35    fn default() -> Self {
36        Self {
37            enable: true,
38            addr: "127.0.0.1:4002".to_string(),
39            runtime_size: 2,
40            tls: TlsOption::default(),
41            reject_no_database: None,
42            keep_alive: std::time::Duration::from_secs(0),
43        }
44    }
45}