mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 04:41:46 +03:00
add application_name to PG connection (#1325)
This commit is contained in:
parent
8c82423fc3
commit
c49648ca18
@ -50,10 +50,14 @@ pub fn parse_conn_str(conn_str: &str) -> PgResult<(Config, SslModeOverride)> {
|
||||
} else {
|
||||
Config::from_str(conn_str)
|
||||
};
|
||||
let pg_cfg = pg_cfg.map_err(|e| BadConnectionString(e, conn_str.to_string()))?;
|
||||
let mut pg_cfg = pg_cfg.map_err(|e| BadConnectionString(e, conn_str.to_string()))?;
|
||||
if let SslModeOverride::Unmodified(_) = mode {
|
||||
mode = SslModeOverride::Unmodified(pg_cfg.get_ssl_mode());
|
||||
}
|
||||
let crate_ver = env!("CARGO_PKG_VERSION");
|
||||
if pg_cfg.get_application_name().is_none() {
|
||||
pg_cfg.application_name(&format!("Martin v{crate_ver} - pid={}", std::process::id()));
|
||||
}
|
||||
Ok((pg_cfg, mode))
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ pub fn new_server(config: SrvConfig, state: ServerState) -> MartinResult<(Server
|
||||
let listen_addresses = config
|
||||
.listen_addresses
|
||||
.clone()
|
||||
.unwrap_or_else(|| LISTEN_ADDRESSES_DEFAULT.to_owned());
|
||||
.unwrap_or_else(|| LISTEN_ADDRESSES_DEFAULT.to_string());
|
||||
|
||||
let factory = move || {
|
||||
let cors_middleware = Cors::default()
|
||||
|
@ -133,9 +133,9 @@ impl<'a> DynTileSource<'a> {
|
||||
CacheValue::Tile,
|
||||
s.get_tile(xyz, self.query_obj.as_ref()),
|
||||
{
|
||||
let id = s.get_id().to_owned();
|
||||
let id = s.get_id().to_string();
|
||||
if let Some(query_str) = self.query_str {
|
||||
CacheKey::TileWithQuery(id, xyz, query_str.to_owned())
|
||||
CacheKey::TileWithQuery(id, xyz, query_str.to_string())
|
||||
} else {
|
||||
CacheKey::Tile(id, xyz)
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ async fn get_source_info(
|
||||
.get("x-rewrite-url")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.and_then(|v| v.parse::<Uri>().ok())
|
||||
.map_or_else(|| req.path().to_owned(), |v| v.path().to_owned())
|
||||
.map_or_else(|| req.path().to_string(), |v| v.path().to_string())
|
||||
};
|
||||
|
||||
let query_string = req.query_string();
|
||||
|
Loading…
Reference in New Issue
Block a user