martin-g commented on code in PR #1433: URL: https://github.com/apache/datafusion-ballista/pull/1433#discussion_r2749673941
########## ballista-cli/src/tui/infrastructure/config.rs: ########## @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use config::{Config, ConfigError, Environment, File, FileFormat}; +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +pub struct SchedulerSettings { + pub url: String, +} + +#[derive(Debug, Deserialize)] +pub struct HttpSettings { + /// Connection timeout. In millis + pub timeout: u64, +} + +#[derive(Debug, Deserialize)] +pub struct Settings { + pub scheduler: SchedulerSettings, + pub http: HttpSettings, +} + +const DEFAULT_CONFIG: &str = r#" +scheduler: + url: http://localhost:50050 + +http: + timeout: 2000 +"#; + +impl Settings { + pub(crate) fn new() -> Result<Self, ConfigError> { + let config_dir = dirs::config_dir() + .unwrap_or_else(|| dirs::home_dir().unwrap().join(".config")) + .join("ballista-tui"); Review Comment: How about just `ballista` ? And then use `cli` and/or `tui` as a parent node in the config. This way the same config file could be used to provide the defaults for the whole cli+tui app and maybe even for the scheduler and executors later. AFAIS the cli app starts a scheduler and executor if host+port are not provided. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
