• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / etl / 15678617192

16 Jun 2025 10:41AM UTC coverage: 59.818% (+0.009%) from 59.809%
15678617192

push

github

web-flow
ref(postgres): Rename `PgDatabaseOptions` structs (#145)

24 of 31 new or added lines in 9 files covered. (77.42%)

2 existing lines in 2 files now uncovered.

5005 of 8367 relevant lines covered (59.82%)

235.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/api/src/main.rs
1
use std::env;
2

3
use anyhow::anyhow;
4
use api::{
5
    configuration::{get_settings, Settings},
6
    startup::Application,
7
};
8
use postgres::sqlx::config::PgConnectionConfig;
9
use telemetry::init_tracing;
10
use tracing::{error, info};
11

12
#[actix_web::main]
13
pub async fn main() -> anyhow::Result<()> {
14
    let app_name = env!("CARGO_BIN_NAME");
15
    // We pass emit_on_span_close = true to emit logs on span close
16
    // for the api because it is a web server and we need to emit logs
17
    // for every closing request. This is a bit of a hack, but it works
18
    // for now. Ideally the tracing middleware should emit a log on
19
    // request end, but it doesn't do that yet.
20
    let _log_flusher = init_tracing(app_name, true)?;
21
    let mut args = env::args();
22

23
    match args.len() {
24
        // Run the application server
25
        1 => {
26
            let configuration = get_settings::<'_, Settings>()?;
27
            log_pg_database_options(&configuration.database);
28
            let application = Application::build(configuration.clone()).await?;
29
            application.run_until_stopped().await?;
30
        }
31
        // Handle single command commands
32
        2 => {
33
            let command = args.nth(1).unwrap();
34
            match command.as_str() {
35
                "migrate" => {
36
                    let options = get_settings::<'_, PgConnectionConfig>()?;
37
                    log_pg_database_options(&options);
38
                    Application::migrate_database(options).await?;
39
                    info!("database migrated successfully");
40
                }
41
                _ => {
42
                    let message = format!("invalid command: {command}");
43
                    error!("{message}");
44
                    return Err(anyhow!(message));
45
                }
46
            }
47
        }
48
        _ => {
49
            let message = "invalid number of command line arguments";
50
            error!("{message}");
51
            return Err(anyhow!(message));
52
        }
53
    }
54

55
    Ok(())
56
}
57

NEW
58
fn log_pg_database_options(config: &PgConnectionConfig) {
×
59
    info!(
×
60
        host = config.host,
61
        port = config.port,
62
        dbname = config.name,
63
        username = config.username,
64
        require_ssl = config.require_ssl,
UNCOV
65
        "pg database options",
×
66
    );
67
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc