Validate that all required keys are present in either config or CLI.
(&self)
| 768 | |
| 769 | /// Validate that all required keys are present in either config or CLI. |
| 770 | pub fn validate(&self) -> Result<(), CommandConfigError> { |
| 771 | for key in &self.schema.keys { |
| 772 | if key.is_required() |
| 773 | && !self.config_values.contains_key(key.config_name()) |
| 774 | && !self.schema.is_from_cli(self.matches, key.config_name()) |
| 775 | { |
| 776 | return Err(CommandConfigError::MissingRequiredKey { |
| 777 | key: key.config_name().to_string(), |
| 778 | }); |
| 779 | } |
| 780 | } |
| 781 | Ok(()) |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | impl SpacetimeConfig { |