1
+ //! # Configuring the tangram CLI and server
2
+ //!
3
+ //! Tangram can be configured by a global config file located at $HOME/.config/config.json or by passing the `--config <path>` option to the `tg` command line before any subcommand, for example
4
+ //!
5
+ //! ```sh
6
+ //! # Run the server using a config file.
7
+ //! tg --config config.json server run
8
+ //! ```
1
9
use serde_with:: serde_as;
2
10
use std:: path:: PathBuf ;
3
11
use tangram_client as tg;
@@ -6,57 +14,75 @@ use url::Url;
6
14
#[ serde_as]
7
15
#[ derive( Clone , Debug , Default , serde:: Serialize , serde:: Deserialize ) ]
8
16
pub struct Config {
17
+ /// Advanced configuration options.
9
18
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
10
19
pub advanced : Option < Advanced > ,
11
20
12
21
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
13
22
pub autoenv : Option < Autoenv > ,
14
23
24
+ /// Configure the server's build options.
15
25
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
16
26
pub build : Option < Build > ,
17
27
28
+ /// Configure the server's database options.
18
29
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
19
30
pub database : Option < Database > ,
20
31
32
+ /// Configure the server's file system monitoring options.
33
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
34
+ pub file_system_monitor : Option < FileSystemMonitor > ,
35
+
21
36
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
22
37
pub messenger : Option < Messenger > ,
23
38
24
39
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
25
40
pub oauth : Option < Oauth > ,
26
41
42
+ /// Configure the server's path. Default = `$HOME/.tangram`.
27
43
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
28
44
pub path : Option < PathBuf > ,
29
45
46
+ /// A list of remote servers that this server can push and pull objects/builds from.
30
47
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
31
48
pub remotes : Option < Vec < Remote > > ,
32
49
50
+ /// Server and CLI tracing options.
33
51
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
34
52
pub tracing : Option < Tracing > ,
35
53
54
+ /// The URL of the server, if serving over tcp.
36
55
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
37
56
pub url : Option < Url > ,
38
57
58
+ /// Configurate the virtual file system.
39
59
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
40
60
pub vfs : Option < Vfs > ,
41
61
}
42
62
43
63
#[ derive( Clone , Debug , Default , serde:: Serialize , serde:: Deserialize ) ]
44
64
pub struct Advanced {
65
+ /// Configure how errors are displayed in the CLI.
45
66
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
46
67
pub error_trace_options : Option < tg:: error:: TraceOptions > ,
47
68
69
+ /// Configure the number of file descriptors available in the client.
48
70
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
49
71
pub file_descriptor_limit : Option < u64 > ,
50
72
73
+ /// Configure the number of file descriptors available in the server.
51
74
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
52
75
pub file_descriptor_semaphore_size : Option < usize > ,
53
76
77
+ /// Toggle whether temp directories are preserved or deleted after builds. Default = false.
54
78
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
55
79
pub preserve_temp_directories : Option < bool > ,
56
80
81
+ /// Toggle whether tokio-console support is enabled. Default = false.
57
82
#[ serde( default , skip_serializing_if = "std::ops::Not::not" ) ]
58
83
pub tokio_console : bool ,
59
84
85
+ /// Toggle whether log messages are printed to the server's stderr. Default = false.
60
86
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
61
87
pub write_build_logs_to_stderr : Option < bool > ,
62
88
}
@@ -69,7 +95,7 @@ pub struct Autoenv {
69
95
70
96
#[ derive( Clone , Debug , Default , serde:: Serialize , serde:: Deserialize ) ]
71
97
pub struct Build {
72
- /// Enable builds.
98
+ /// Toggle whether builds are enabled on this server .
73
99
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
74
100
pub enable : Option < bool > ,
75
101
@@ -85,6 +111,12 @@ pub enum Database {
85
111
Postgres ( PostgresDatabase ) ,
86
112
}
87
113
114
+ #[ derive( Clone , Debug , serde:: Serialize , serde:: Deserialize ) ]
115
+ pub struct FileSystemMonitor {
116
+ /// Toggle whether the file system monitor is enabled. Default = true.
117
+ pub enable : bool ,
118
+ }
119
+
88
120
#[ derive( Clone , Debug , serde:: Serialize , serde:: Deserialize ) ]
89
121
pub struct SqliteDatabase {
90
122
/// The maximum number of connections.
@@ -149,8 +181,11 @@ pub struct RemoteBuild {
149
181
150
182
#[ derive( Clone , Debug , Default , serde:: Serialize , serde:: Deserialize ) ]
151
183
pub struct Tracing {
184
+ /// The filter applied to tracing messages.
152
185
#[ serde( default , skip_serializing_if = "String::is_empty" ) ]
153
186
pub filter : String ,
187
+
188
+ /// The display format of tracing messages.
154
189
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
155
190
pub format : Option < TracingFormat > ,
156
191
}
@@ -190,6 +225,7 @@ impl std::str::FromStr for TracingFormat {
190
225
191
226
#[ derive( Clone , Debug , Default , serde:: Serialize , serde:: Deserialize ) ]
192
227
pub struct Vfs {
228
+ /// Toggle whether the VFS is enabled. When the VFS is disabled, checkouts will be made onto local disk. Default = true.
193
229
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
194
230
pub enable : Option < bool > ,
195
231
}
0 commit comments