reactive_graph_config_api/
config_manager.rs

1use std::path::PathBuf;
2
3use springtime_di::injectable;
4
5use reactive_graph_config_model::GraphQLServerConfig;
6use reactive_graph_config_model::InstanceConfig;
7use reactive_graph_config_model::PluginsConfig;
8use reactive_graph_config_model::RemotesConfig;
9use reactive_graph_lifecycle::Lifecycle;
10
11#[injectable]
12pub trait ConfigManager: Send + Sync + Lifecycle {
13    /// Returns the location of the configuration of the instance.
14    fn get_instance_config_location(&self) -> PathBuf;
15
16    /// Sets the location of the configuration of the instance.
17    fn set_instance_config_location(&self, instance_config_location: PathBuf);
18
19    /// Returns the location of the configuration of the GraphQL server.
20    fn get_graphql_server_config_location(&self) -> PathBuf;
21
22    /// Sets the location of the configuration of the GraphQL server.
23    fn set_graphql_server_config_location(&self, graphql_server_config_location: PathBuf);
24
25    /// Returns the location of the plugins configuration.
26    fn get_plugins_config_location(&self) -> PathBuf;
27
28    /// Sets the location of the plugins configuration.
29    fn set_plugins_config_location(&self, plugins_config_location: PathBuf);
30
31    /// Returns the location of the remotes configuration.
32    fn get_remotes_config_location(&self) -> PathBuf;
33
34    /// Sets the location of the remotes configuration.
35    fn set_remotes_config_location(&self, remotes_config_location: PathBuf);
36
37    /// Returns the configuration of the instance.
38    fn get_instance_config(&self) -> InstanceConfig;
39
40    /// Sets the configuration of the instance.
41    fn set_instance_config(&self, instance_config: InstanceConfig);
42
43    /// Reads the configuration of the instance from file.
44    fn read_instance_config(&self);
45
46    /// Sets the instance name.
47    fn set_instance_name(&self, instance_name: &str);
48
49    /// Sets the instance description.
50    fn set_instance_description(&self, instance_description: &str);
51
52    /// Returns the configuration of the GraphQL server.
53    fn get_graphql_server_config(&self) -> GraphQLServerConfig;
54
55    /// Sets the configuration of the GraphQL server.
56    fn set_graphql_server_config(&self, graphql_server_config: GraphQLServerConfig);
57
58    /// Reads the configuration of the GraphQL server from file.
59    fn read_graphql_server_config(&self);
60
61    /// Sets the host name.
62    fn set_graphql_hostname(&self, hostname: &str);
63
64    /// Sets the port.
65    fn set_graphql_port(&self, port: u16);
66
67    /// Enables / disables HTTPS.
68    fn set_graphql_secure(&self, secure: bool);
69
70    /// Sets the SSL certificate path.
71    fn set_graphql_ssl_certificate_path(&self, ssl_certificate_path: &str);
72
73    /// Sets the SSL private key path.
74    fn set_graphql_ssl_private_key_path(&self, ssl_private_key_path: &str);
75
76    /// Sets the timeout for graceful workers shutdown in seconds.
77    fn set_graphql_shutdown_timeout(&self, shutdown_timeout: u64);
78
79    /// Sets the number of workers.
80    fn set_graphql_workers(&self, workers: usize);
81
82    /// Returns the default context path which redirects the root context to a web resource provider.
83    fn get_graphql_default_context_path(&self) -> Option<String>;
84
85    /// Sets the default context path which redirects the root context to a web resource provider.
86    fn set_graphql_default_context_path(&self, default_context_path: String);
87
88    /// Returns the plugins configuration.
89    fn get_plugins_config(&self) -> PluginsConfig;
90
91    /// Sets the plugins configuration.
92    fn set_plugins_config(&self, plugins_config: PluginsConfig);
93
94    /// Reads the plugins configuration from file.
95    fn read_plugins_config(&self);
96
97    /// Enables / disables all plugins.
98    fn set_disable_all_plugins(&self, disable_all_plugins: bool);
99
100    /// Sets the plugins to disable.
101    fn set_disabled_plugins(&self, disabled_plugins: Vec<String>);
102
103    /// Sets the plugins to enable. If set, set_disabled_plugins will have no effect.
104    fn set_enabled_plugins(&self, enabled_plugins: Vec<String>);
105
106    /// Enables / disables hot deploy.
107    fn set_disable_hot_deploy(&self, disable_hot_deploy: bool);
108
109    /// Sets the plugins hot deploy location.
110    fn set_hot_deploy_location(&self, hot_deploy_location: Option<String>);
111
112    /// Sets the plugins install location.
113    fn set_install_location(&self, install_location: Option<String>);
114
115    /// Returns the remotes.
116    fn get_remotes_config(&self) -> RemotesConfig;
117
118    /// Sets the remotes configuration.
119    fn set_remotes_config(&self, remotes: RemotesConfig);
120
121    /// Reads the remotes configuration from file.
122    fn read_remotes_config(&self);
123
124    /// Writes the remotes configuration to file.
125    fn write_remotes_config(&self);
126}