frontend/service_config/
postgres.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 PostgresOptions {
20    pub enable: bool,
21    pub addr: String,
22    pub runtime_size: usize,
23    #[serde(default = "Default::default")]
24    pub tls: TlsOption,
25    /// Server-side keep-alive time.
26    ///
27    /// Set to 0 (default) to disable.
28    #[serde(default = "Default::default")]
29    #[serde(with = "humantime_serde")]
30    pub keep_alive: std::time::Duration,
31}
32
33impl Default for PostgresOptions {
34    fn default() -> Self {
35        Self {
36            enable: true,
37            addr: "127.0.0.1:4003".to_string(),
38            runtime_size: 2,
39            tls: Default::default(),
40            keep_alive: std::time::Duration::from_secs(0),
41        }
42    }
43}