• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 3977575075

pending completion
3977575075

push

github

GitHub
Chore/apply flags config (#664)

139 of 139 new or added lines in 10 files covered. (100.0%)

22504 of 34428 relevant lines covered (65.37%)

72228.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.2
/dozer-types/src/models/api_config.rs
1
use serde::{Deserialize, Serialize};
2

3
use crate::constants::DEFAULT_HOME_DIR;
4

5
use super::api_security::ApiSecurity;
6
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, prost::Message)]
30✔
7
#[serde(default = "default_api_config")]
8
pub struct ApiConfig {
9
    #[prost(oneof = "ApiSecurity", tags = "1")]
10
    #[serde(skip_serializing_if = "Option::is_none")]
11
    /// The security configuration for the API; Default: None
12
    pub api_security: Option<ApiSecurity>,
13
    #[prost(message, tag = "2")]
14
    #[serde(default = "default_api_rest")]
15
    pub rest: Option<ApiRest>,
16
    #[prost(message, tag = "3")]
17
    #[serde(default = "default_api_grpc")]
18
    pub grpc: Option<ApiGrpc>,
19
    #[prost(bool, tag = "4")]
20
    pub auth: bool,
21
    #[prost(message, tag = "5")]
22
    #[serde(default = "default_api_internal")]
23
    pub api_internal: Option<ApiInternal>,
24
    #[prost(message, tag = "6")]
25
    #[serde(skip_serializing_if = "Option::is_none")]
26
    #[serde(default = "default_pipeline_internal")]
27
    pub pipeline_internal: Option<ApiPipelineInternal>,
28
    #[prost(string, optional, tag = "7")]
29
    #[serde(skip_serializing_if = "Option::is_none")]
30
    pub app_id: Option<String>,
31
    #[serde(skip_serializing_if = "Option::is_none")]
32
    #[prost(string, optional, tag = "8")]
33
    pub id: Option<String>,
34
}
35
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, prost::Message)]
15✔
36
pub struct ApiRest {
37
    #[prost(uint32, tag = "1")]
38
    #[serde(default = "default_rest_port")]
39
    pub port: u32,
40
    #[prost(string, tag = "2")]
41
    #[serde(default = "default_host")]
42
    pub host: String,
43
    #[prost(bool, tag = "3")]
44
    #[serde(default = "default_cors")]
45
    pub cors: bool,
46
}
47
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, prost::Message)]
12✔
48
pub struct ApiGrpc {
49
    #[prost(uint32, tag = "1")]
50
    #[serde(default = "default_grpc_port")]
51
    pub port: u32,
52
    #[prost(string, tag = "2")]
53
    #[serde(default = "default_host")]
54
    pub host: String,
55
    #[prost(bool, tag = "3")]
56
    #[serde(default = "default_cors")]
57
    pub cors: bool,
58
    #[prost(bool, tag = "4")]
59
    #[serde(default = "default_enable_web")]
60
    pub web: bool,
61
}
62

63
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, prost::Message)]
13✔
64
pub struct ApiPipelineInternal {
65
    #[prost(uint32, tag = "1")]
66
    #[serde(default = "default_pipeline_internal_port")]
67
    pub port: u32,
68
    #[prost(string, tag = "2")]
69
    #[serde(default = "default_pipeline_internal_host")]
70
    pub host: String,
71
    #[prost(string, tag = "3")]
72
    #[serde(default = "default_pipeline_internal_home_dir")]
73
    pub home_dir: String,
74
}
75

76
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, prost::Message)]
×
77
pub struct ApiInternal {
78
    #[prost(string, tag = "1")]
79
    #[serde(default = "default_api_internal_home_dir")]
80
    pub home_dir: String,
81
}
82

83
fn default_api_internal_home_dir() -> String {
×
84
    format!("{:}/api", DEFAULT_HOME_DIR.to_owned())
×
85
}
×
86
fn default_api_internal() -> Option<ApiInternal> {
234✔
87
    Some(ApiInternal {
234✔
88
        home_dir: format!("{:}/api", DEFAULT_HOME_DIR.to_owned()),
234✔
89
    })
234✔
90
}
234✔
91
fn default_pipeline_internal_port() -> u32 {
234✔
92
    50053
234✔
93
}
234✔
94
fn default_pipeline_internal_host() -> String {
235✔
95
    "0.0.0.0".to_owned()
235✔
96
}
235✔
97
fn default_pipeline_internal_home_dir() -> String {
234✔
98
    format!("{:}/pipeline", DEFAULT_HOME_DIR.to_owned())
234✔
99
}
234✔
100
pub(crate) fn default_pipeline_internal() -> Option<ApiPipelineInternal> {
234✔
101
    Some(ApiPipelineInternal {
234✔
102
        port: default_pipeline_internal_port(),
234✔
103
        host: default_pipeline_internal_host(),
234✔
104
        home_dir: default_pipeline_internal_home_dir(),
234✔
105
    })
234✔
106
}
234✔
107
pub(crate) fn default_api_rest() -> Option<ApiRest> {
235✔
108
    Some(ApiRest {
235✔
109
        port: default_rest_port(),
235✔
110
        host: default_host(),
235✔
111
        cors: default_cors(),
235✔
112
    })
235✔
113
}
235✔
114
pub(crate) fn default_api_grpc() -> Option<ApiGrpc> {
236✔
115
    Some(ApiGrpc {
236✔
116
        port: default_grpc_port(),
236✔
117
        host: default_host(),
236✔
118
        cors: default_cors(),
236✔
119
        web: default_enable_web(),
236✔
120
    })
236✔
121
}
236✔
122
fn default_grpc_port() -> u32 {
236✔
123
    50051
236✔
124
}
236✔
125
fn default_rest_port() -> u32 {
236✔
126
    8080
236✔
127
}
236✔
128
fn default_enable_web() -> bool {
240✔
129
    true
240✔
130
}
240✔
131
fn default_cors() -> bool {
480✔
132
    true
480✔
133
}
480✔
134

135
fn default_host() -> String {
479✔
136
    "0.0.0.0".to_owned()
479✔
137
}
479✔
138
pub fn default_api_config() -> ApiConfig {
228✔
139
    ApiConfig {
228✔
140
        rest: default_api_rest(),
228✔
141
        grpc: default_api_grpc(),
228✔
142
        auth: false,
228✔
143
        api_internal: default_api_internal(),
228✔
144
        pipeline_internal: default_pipeline_internal(),
228✔
145
        ..Default::default()
228✔
146
    }
228✔
147
}
228✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc