mirror of
https://github.com/maplibre/martin.git
synced 2024-12-18 12:21:56 +03:00
Deprecate few things, lock and lints (#1111)
* Remove `CA_ROOT_FILE` env var support (has been deprecated for a while) * Remove `WATCH_MODE` env var warning - has not been in use since a long time ago * minor lints/clippy suggestions, lock update
This commit is contained in:
parent
a44c7d5976
commit
4f7487b448
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -214,9 +214,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.8.6"
|
version = "0.8.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
|
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"getrandom",
|
"getrandom",
|
||||||
@ -578,9 +578,9 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo-platform"
|
name = "cargo-platform"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff"
|
checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -1820,13 +1820,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-terminal"
|
name = "is-terminal"
|
||||||
version = "0.4.9"
|
version = "0.4.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2110,9 +2110,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.6.4"
|
version = "2.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memmap2"
|
name = "memmap2"
|
||||||
@ -3474,9 +3474,9 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "similar"
|
name = "similar"
|
||||||
version = "2.3.0"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597"
|
checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simplecss"
|
name = "simplecss"
|
||||||
@ -3982,15 +3982,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.8.1"
|
version = "3.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
|
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
You can also configure Martin using environment variables, but only if the configuration file is not used. See [configuration section](config-file.md) on how to use environment variables with config files. See also [SSL configuration](pg-connections.md#postgresql-ssl-connections) section below.
|
You can also configure Martin using environment variables, but only if the configuration file is not used. See [configuration section](config-file.md) on how to use environment variables with config files. See also [SSL configuration](pg-connections.md#postgresql-ssl-connections) section below.
|
||||||
|
|
||||||
| Environment var <br/> Config File key | Example | Description |
|
| Environment var <br/> Config File key | Example | Description |
|
||||||
|------------------------------------------|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------------------------------|--------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `DATABASE_URL` <br/> `connection_string` | `postgresql://postgres@localhost/db` | Postgres database connection |
|
| `DATABASE_URL` <br/> `connection_string` | `postgresql://postgres@localhost/db` | Postgres database connection |
|
||||||
| `DEFAULT_SRID` <br/> `default_srid` | `4326` | If a PostgreSQL table has a geometry column with SRID=0, use this value instead |
|
| `DEFAULT_SRID` <br/> `default_srid` | `4326` | If a PostgreSQL table has a geometry column with SRID=0, use this value instead |
|
||||||
| `PGSSLCERT` <br/> `ssl_cert` | `./postgresql.crt` | A file with a client SSL certificate. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLCERT) |
|
| `PGSSLCERT` <br/> `ssl_cert` | `./postgresql.crt` | A file with a client SSL certificate. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLCERT) |
|
||||||
| `PGSSLKEY` <br/> `ssl_key` | `./postgresql.key` | A file with the key for the client SSL certificate. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLKEY) |
|
| `PGSSLKEY` <br/> `ssl_key` | `./postgresql.key` | A file with the key for the client SSL certificate. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLKEY) |
|
||||||
| `PGSSLROOTCERT` <br/> `ssl_root_cert` | `./root.crt` | A file with trusted root certificate(s). The file should contain a sequence of PEM-formatted CA certificates. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT)<br/>This env var used to be called `CA_ROOT_FILE`, but support for it will be removed soon. |
|
| `PGSSLROOTCERT` <br/> `ssl_root_cert` | `./root.crt` | A file with trusted root certificate(s). The file should contain a sequence of PEM-formatted CA certificates. [docs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT) |
|
||||||
|
@ -105,7 +105,6 @@ impl PgArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for v in &[
|
for v in &[
|
||||||
"CA_ROOT_FILE",
|
|
||||||
"DANGER_ACCEPT_INVALID_CERTS",
|
"DANGER_ACCEPT_INVALID_CERTS",
|
||||||
"DATABASE_URL",
|
"DATABASE_URL",
|
||||||
"DEFAULT_SRID",
|
"DEFAULT_SRID",
|
||||||
@ -167,13 +166,6 @@ impl PgArgs {
|
|||||||
if result.ssl_root_cert.is_none() {
|
if result.ssl_root_cert.is_none() {
|
||||||
result.ssl_root_cert = Self::parse_env_var(env, "PGSSLROOTCERT", "root certificate(s)");
|
result.ssl_root_cert = Self::parse_env_var(env, "PGSSLROOTCERT", "root certificate(s)");
|
||||||
}
|
}
|
||||||
if result.ssl_root_cert.is_none() {
|
|
||||||
result.ssl_root_cert = Self::parse_env_var(
|
|
||||||
env,
|
|
||||||
"CA_ROOT_FILE",
|
|
||||||
"root certificate(s). This setting is obsolete, please use PGSSLROOTCERT instead",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
@ -255,7 +247,7 @@ mod tests {
|
|||||||
("DATABASE_URL", os("postgres://localhost:5432")),
|
("DATABASE_URL", os("postgres://localhost:5432")),
|
||||||
("DEFAULT_SRID", os("10")),
|
("DEFAULT_SRID", os("10")),
|
||||||
("DANGER_ACCEPT_INVALID_CERTS", os("1")),
|
("DANGER_ACCEPT_INVALID_CERTS", os("1")),
|
||||||
("CA_ROOT_FILE", os("file")),
|
("PGSSLROOTCERT", os("file")),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect(),
|
.collect(),
|
||||||
|
@ -65,14 +65,11 @@ impl Args {
|
|||||||
pub fn merge_into_config<'a>(
|
pub fn merge_into_config<'a>(
|
||||||
self,
|
self,
|
||||||
config: &mut Config,
|
config: &mut Config,
|
||||||
env: &impl Env<'a>,
|
#[allow(unused_variables)] env: &impl Env<'a>,
|
||||||
) -> MartinResult<()> {
|
) -> MartinResult<()> {
|
||||||
if self.meta.watch {
|
if self.meta.watch {
|
||||||
warn!("The --watch flag is no longer supported, and will be ignored");
|
warn!("The --watch flag is no longer supported, and will be ignored");
|
||||||
}
|
}
|
||||||
if env.has_unused_var("WATCH_MODE") {
|
|
||||||
warn!("The WATCH_MODE env variable is no longer supported, and will be ignored");
|
|
||||||
}
|
|
||||||
if self.meta.config.is_some() && !self.meta.connection.is_empty() {
|
if self.meta.config.is_some() && !self.meta.connection.is_empty() {
|
||||||
return Err(ConfigAndConnectionsError(self.meta.connection));
|
return Err(ConfigAndConnectionsError(self.meta.connection));
|
||||||
}
|
}
|
||||||
@ -138,19 +135,17 @@ pub fn parse_file_args<T: crate::file_config::ConfigExtras>(
|
|||||||
) -> FileConfigEnum<T> {
|
) -> FileConfigEnum<T> {
|
||||||
use crate::args::State::{Ignore, Share, Take};
|
use crate::args::State::{Ignore, Share, Take};
|
||||||
|
|
||||||
let paths = cli_strings.process(|s| match PathBuf::try_from(s) {
|
let paths = cli_strings.process(|s| {
|
||||||
Ok(v) => {
|
let path = PathBuf::from(s);
|
||||||
if allow_url && is_url(s, extension) {
|
if allow_url && is_url(s, extension) {
|
||||||
Take(v)
|
Take(path)
|
||||||
} else if v.is_dir() {
|
} else if path.is_dir() {
|
||||||
Share(v)
|
Share(path)
|
||||||
} else if v.is_file() && v.extension().map_or(false, |e| e == extension) {
|
} else if path.is_file() && path.extension().map_or(false, |e| e == extension) {
|
||||||
Take(v)
|
Take(path)
|
||||||
} else {
|
} else {
|
||||||
Ignore
|
Ignore
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(_) => Ignore,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
FileConfigEnum::new(paths)
|
FileConfigEnum::new(paths)
|
||||||
|
@ -456,6 +456,41 @@ LIMIT 1;"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Compute the hash of the combined tiles in the mbtiles file tiles table/view.
|
||||||
|
/// This should work on all mbtiles files perf `MBTiles` specification.
|
||||||
|
pub async fn calc_agg_tiles_hash<T>(conn: &mut T) -> MbtResult<String>
|
||||||
|
where
|
||||||
|
for<'e> &'e mut T: SqliteExecutor<'e>,
|
||||||
|
{
|
||||||
|
debug!("Calculating agg_tiles_hash");
|
||||||
|
let query = query(
|
||||||
|
// The md5_concat func will return NULL if there are no rows in the tiles table.
|
||||||
|
// For our use case, we will treat it as an empty string, and hash that.
|
||||||
|
// `tile_data` values must be stored as a blob per MBTiles spec
|
||||||
|
// `md5` functions will fail if the value is not text/blob/null
|
||||||
|
//
|
||||||
|
// Note that ORDER BY controls the output ordering, which is important for the hash value,
|
||||||
|
// and having it at the top level would not order values properly.
|
||||||
|
// See https://sqlite.org/forum/forumpost/228bb96e12a746ce
|
||||||
|
"
|
||||||
|
SELECT coalesce(
|
||||||
|
(SELECT md5_concat_hex(
|
||||||
|
cast(zoom_level AS text),
|
||||||
|
cast(tile_column AS text),
|
||||||
|
cast(tile_row AS text),
|
||||||
|
tile_data
|
||||||
|
)
|
||||||
|
OVER (ORDER BY zoom_level, tile_column, tile_row ROWS
|
||||||
|
BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
||||||
|
FROM tiles
|
||||||
|
LIMIT 1),
|
||||||
|
md5_hex('')
|
||||||
|
);
|
||||||
|
",
|
||||||
|
);
|
||||||
|
Ok(query.fetch_one(conn).await?.get::<String, _>(0))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod tests {
|
pub(crate) mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -499,38 +534,3 @@ pub(crate) mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the hash of the combined tiles in the mbtiles file tiles table/view.
|
|
||||||
/// This should work on all mbtiles files perf `MBTiles` specification.
|
|
||||||
pub async fn calc_agg_tiles_hash<T>(conn: &mut T) -> MbtResult<String>
|
|
||||||
where
|
|
||||||
for<'e> &'e mut T: SqliteExecutor<'e>,
|
|
||||||
{
|
|
||||||
debug!("Calculating agg_tiles_hash");
|
|
||||||
let query = query(
|
|
||||||
// The md5_concat func will return NULL if there are no rows in the tiles table.
|
|
||||||
// For our use case, we will treat it as an empty string, and hash that.
|
|
||||||
// `tile_data` values must be stored as a blob per MBTiles spec
|
|
||||||
// `md5` functions will fail if the value is not text/blob/null
|
|
||||||
//
|
|
||||||
// Note that ORDER BY controls the output ordering, which is important for the hash value,
|
|
||||||
// and having it at the top level would not order values properly.
|
|
||||||
// See https://sqlite.org/forum/forumpost/228bb96e12a746ce
|
|
||||||
"
|
|
||||||
SELECT coalesce(
|
|
||||||
(SELECT md5_concat_hex(
|
|
||||||
cast(zoom_level AS text),
|
|
||||||
cast(tile_column AS text),
|
|
||||||
cast(tile_row AS text),
|
|
||||||
tile_data
|
|
||||||
)
|
|
||||||
OVER (ORDER BY zoom_level, tile_column, tile_row ROWS
|
|
||||||
BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
|
||||||
FROM tiles
|
|
||||||
LIMIT 1),
|
|
||||||
md5_hex('')
|
|
||||||
);
|
|
||||||
",
|
|
||||||
);
|
|
||||||
Ok(query.fetch_one(conn).await?.get::<String, _>(0))
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user