Skip to content

Commit ef74143

Browse files
committed
feat(gb-9000): fix cli run without .env and config file
1 parent 7f2adae commit ef74143

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/postgres/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grafbase-postgres"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
edition = "2024"
55
license = "Apache-2.0"
66

cli/postgres/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod args;
66

77
#[tokio::main(flavor = "current_thread")]
88
async fn main() -> anyhow::Result<()> {
9-
dotenv::dotenv()?;
9+
dotenv::dotenv().ok();
1010

1111
let args = args::parse();
1212
let mut conn = PgConnection::connect(&args.database_url).await?;
@@ -21,7 +21,11 @@ async fn main() -> anyhow::Result<()> {
2121
}
2222

2323
async fn introspect(conn: &mut PgConnection, cmd: IntrospectCommand) -> anyhow::Result<()> {
24-
let config = std::fs::read_to_string(&cmd.config).context("could not read the configuration file")?;
24+
let config = std::fs::read_to_string(&cmd.config).context(concat!(
25+
"Could not find a configuration file. Please provide a valid path ",
26+
"with --config, or make sure file ./grafbase-postgres.toml exists."
27+
))?;
28+
2529
let config = toml::from_str(&config)?;
2630
let sdl = grafbase_postgres_introspection::introspect(conn, config).await?;
2731

0 commit comments

Comments
 (0)