Skip to content

Commit

Permalink
Merge pull request #289 from umccr/feat/error-no-config
Browse files Browse the repository at this point in the history
fix: error on no config
  • Loading branch information
mmalenic authored Jan 6, 2025
2 parents 225f6a3 + 8dd0273 commit 27ddce2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion htsget-config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::config::location::{Location, LocationEither, Locations};
use crate::config::parser::from_path;
use crate::config::service_info::ServiceInfo;
use crate::config::ticket_server::TicketServerConfig;
use crate::error::Error::{ArgParseError, TracingError};
use crate::error::Error::{ArgParseError, ParseError, TracingError};
use crate::error::Result;
use crate::storage::file::File;
use crate::storage::Backend;
Expand Down Expand Up @@ -111,6 +111,11 @@ impl Config {
pub fn parse_args_with_command(augment_args: Command) -> Result<Option<PathBuf>> {
let args = Args::from_arg_matches(&Args::augment_args(augment_args).get_matches())
.map_err(|err| ArgParseError(err.to_string()))?;

if args.config.as_ref().is_some_and(|path| !path.exists()) {
return Err(ParseError("config file not found".to_string()));
}

Ok(Self::parse_with_args(args))
}

Expand Down

0 comments on commit 27ddce2

Please sign in to comment.