Skip to content

Commit 7cc3fc5

Browse files
authored
chore: rename conf and env vars (#245)
1 parent cbe20b4 commit 7cc3fc5

File tree

22 files changed

+56
-56
lines changed

22 files changed

+56
-56
lines changed

crates/pgt_analyse/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl AnalyserRules {
4545
/// A set of information useful to the analyser infrastructure
4646
#[derive(Debug, Default)]
4747
pub struct AnalyserOptions {
48-
/// A data structured derived from the [`pglt.jsonc`] file
48+
/// A data structured derived from the [`postgrestools.jsonc`] file
4949
pub rules: AnalyserRules,
5050
}
5151

crates/pgt_analyser/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Let's assume that the rule we implement support the following options:
7979
- `threshold`: an integer between 0 and 255;
8080
- `behaviorExceptions`: an array of strings.
8181

82-
We would like to set the options in the `pglt.jsonc` configuration file:
82+
We would like to set the options in the `postgrestools.jsonc` configuration file:
8383

8484
```json
8585
{
@@ -141,9 +141,9 @@ We currently require implementing _serde_'s traits `Deserialize`/`Serialize`.
141141

142142
Also, we use other `serde` macros to adjust the JSON configuration:
143143

144-
- `rename_all = "camelCase"`: it renames all fields in camel-case, so they are in line with the naming style of the `pglt.jsonc`.
144+
- `rename_all = "camelCase"`: it renames all fields in camel-case, so they are in line with the naming style of the `postgrestools.jsonc`.
145145
- `deny_unknown_fields`: it raises an error if the configuration contains extraneous fields.
146-
- `default`: it uses the `Default` value when the field is missing from `pglt.jsonc`. This macro makes the field optional.
146+
- `default`: it uses the `Default` value when the field is missing from `postgrestools.jsonc`. This macro makes the field optional.
147147

148148
You can simply use a derive macros:
149149

crates/pgt_cli/src/cli_options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct CliOptions {
2626
#[bpaf(long("verbose"), switch, fallback(false))]
2727
pub verbose: bool,
2828

29-
/// Set the file path to the configuration file, or the directory path to find `pglt.jsonc`.
29+
/// Set the file path to the configuration file, or the directory path to find `postgrestools.jsonc`.
3030
/// If used, it disables the default configuration file resolution.
3131
#[bpaf(long("config-path"), argument("PATH"), optional)]
3232
pub config_path: Option<String>,

crates/pgt_cli/src/commands/daemon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn setup_tracing_subscriber(log_path: Option<PathBuf>, log_file_name_prefix: Opt
233233
}
234234

235235
pub fn default_pgt_log_path() -> PathBuf {
236-
match env::var_os("PGLT_LOG_PATH") {
236+
match env::var_os("PGT_LOG_PATH") {
237237
Some(directory) => PathBuf::from(directory),
238238
None => pgt_fs::ensure_cache_dir().join("pglt-logs"),
239239
}

crates/pgt_cli/src/commands/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub enum PgtCommand {
5858
changed: bool,
5959

6060
/// Use this to specify the base branch to compare against when you're using the --changed
61-
/// flag and the `defaultBranch` is not set in your `pglt.jsonc`
61+
/// flag and the `defaultBranch` is not set in your `postgrestools.jsonc`
6262
#[bpaf(long("since"), argument("REF"))]
6363
since: Option<String>,
6464

@@ -72,7 +72,7 @@ pub enum PgtCommand {
7272
Start {
7373
/// Allows to change the prefix applied to the file name of the logs.
7474
#[bpaf(
75-
env("PGLT_LOG_PREFIX_NAME"),
75+
env("PGT_LOG_PREFIX_NAME"),
7676
long("log-prefix-name"),
7777
argument("STRING"),
7878
hide_usage,
@@ -83,16 +83,16 @@ pub enum PgtCommand {
8383

8484
/// Allows to change the folder where logs are stored.
8585
#[bpaf(
86-
env("PGLT_LOG_PATH"),
86+
env("PGT_LOG_PATH"),
8787
long("log-path"),
8888
argument("PATH"),
8989
hide_usage,
9090
fallback(pgt_fs::ensure_cache_dir().join("pglt-logs")),
9191
)]
9292
log_path: PathBuf,
9393
/// Allows to set a custom file path to the configuration file,
94-
/// or a custom directory path to find `pglt.jsonc`
95-
#[bpaf(env("PGLT_LOG_PREFIX_NAME"), long("config-path"), argument("PATH"))]
94+
/// or a custom directory path to find `postgrestools.jsonc`
95+
#[bpaf(env("PGT_LOG_PREFIX_NAME"), long("config-path"), argument("PATH"))]
9696
config_path: Option<PathBuf>,
9797
},
9898

@@ -109,7 +109,7 @@ pub enum PgtCommand {
109109
LspProxy {
110110
/// Allows to change the prefix applied to the file name of the logs.
111111
#[bpaf(
112-
env("PGLT_LOG_PREFIX_NAME"),
112+
env("PGT_LOG_PREFIX_NAME"),
113113
long("log-prefix-name"),
114114
argument("STRING"),
115115
hide_usage,
@@ -119,16 +119,16 @@ pub enum PgtCommand {
119119
log_prefix_name: String,
120120
/// Allows to change the folder where logs are stored.
121121
#[bpaf(
122-
env("PGLT_LOG_PATH"),
122+
env("PGT_LOG_PATH"),
123123
long("log-path"),
124124
argument("PATH"),
125125
hide_usage,
126126
fallback(pgt_fs::ensure_cache_dir().join("pglt-logs")),
127127
)]
128128
log_path: PathBuf,
129129
/// Allows to set a custom file path to the configuration file,
130-
/// or a custom directory path to find `pglt.jsonc`
131-
#[bpaf(env("PGLT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
130+
/// or a custom directory path to find `postgrestools.jsonc`
131+
#[bpaf(env("PGT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
132132
config_path: Option<PathBuf>,
133133
/// Bogus argument to make the command work with vscode-languageclient
134134
#[bpaf(long("stdio"), hide, hide_usage, switch)]
@@ -143,7 +143,7 @@ pub enum PgtCommand {
143143
RunServer {
144144
/// Allows to change the prefix applied to the file name of the logs.
145145
#[bpaf(
146-
env("PGLT_LOG_PREFIX_NAME"),
146+
env("PGT_LOG_PREFIX_NAME"),
147147
long("log-prefix-name"),
148148
argument("STRING"),
149149
hide_usage,
@@ -153,7 +153,7 @@ pub enum PgtCommand {
153153
log_prefix_name: String,
154154
/// Allows to change the folder where logs are stored.
155155
#[bpaf(
156-
env("PGLT_LOG_PATH"),
156+
env("PGT_LOG_PATH"),
157157
long("log-path"),
158158
argument("PATH"),
159159
hide_usage,
@@ -164,8 +164,8 @@ pub enum PgtCommand {
164164
#[bpaf(long("stop-on-disconnect"), hide_usage)]
165165
stop_on_disconnect: bool,
166166
/// Allows to set a custom file path to the configuration file,
167-
/// or a custom directory path to find `pglt.jsonc`
168-
#[bpaf(env("PGLT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
167+
/// or a custom directory path to find `postgrestools.jsonc`
168+
#[bpaf(env("PGT_CONFIG_PATH"), long("config-path"), argument("PATH"))]
169169
config_path: Option<PathBuf>,
170170
},
171171
#[bpaf(command("__print_socket"), hide)]

crates/pgt_cli/src/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub enum CliDiagnostic {
4848
IoError(IoDiagnostic),
4949
/// The daemon is not running
5050
ServerNotRunning(ServerNotRunning),
51-
/// The end configuration (`pglt.jsonc` + other options) is incompatible with the command
51+
/// The end configuration (`postgrestools.jsonc` + other options) is incompatible with the command
5252
IncompatibleEndConfiguration(IncompatibleEndConfiguration),
5353
/// No files processed during the file system traversal
5454
NoFilesWereProcessed(NoFilesWereProcessed),
@@ -410,7 +410,7 @@ impl CliDiagnostic {
410410
Self::ServerNotRunning(ServerNotRunning)
411411
}
412412

413-
/// Emitted when the end configuration (`pglt.jsonc` file + CLI arguments + LSP configuration)
413+
/// Emitted when the end configuration (`postgrestools.jsonc` file + CLI arguments + LSP configuration)
414414
/// results in a combination of options that doesn't allow to run the command correctly.
415415
///
416416
/// A reason needs to be provided

crates/pgt_cli/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub use panic::setup_panic_handler;
3232
pub use reporter::{DiagnosticsPayload, Reporter, ReporterVisitor, TraversalSummary};
3333
pub use service::{SocketTransport, open_transport};
3434

35-
pub(crate) const VERSION: &str = match option_env!("PGLT_VERSION") {
35+
pub(crate) const VERSION: &str = match option_env!("PGT_VERSION") {
3636
Some(version) => version,
3737
None => env!("CARGO_PKG_VERSION"),
3838
};

crates/pgt_configuration/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! This module contains the configuration of `pglt.jsonc`
1+
//! This module contains the configuration of `postgrestools.jsonc`
22
//!
33
//! The configuration is divided by "tool", and then it's possible to further customise it
44
//! by language. The language might further options divided by tool.
@@ -34,7 +34,7 @@ use migrations::{
3434
use serde::{Deserialize, Serialize};
3535
use vcs::VcsClientKind;
3636

37-
pub const VERSION: &str = match option_env!("PGLT_VERSION") {
37+
pub const VERSION: &str = match option_env!("PGT_VERSION") {
3838
Some(version) => version,
3939
None => "0.0.0",
4040
};

crates/pgt_configuration/src/vcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct VcsConfiguration {
2828
pub use_ignore_file: bool,
2929

3030
/// The folder where we should check for VCS files. By default, we will use the same
31-
/// folder where `pglt.jsonc` was found.
31+
/// folder where `postgrestools.jsonc` was found.
3232
///
3333
/// If we can't find the configuration, it will attempt to use the current working directory.
3434
/// If no current working directory can't be found, we won't use the VCS integration, and a diagnostic

crates/pgt_flags/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ use std::sync::{LazyLock, OnceLock};
88

99
/// Returns `true` if this is an unstable build of PgLT
1010
pub fn is_unstable() -> bool {
11-
PGLT_VERSION.deref().is_none()
11+
PGT_VERSION.deref().is_none()
1212
}
1313

1414
/// The internal version of PgLT. This is usually supplied during the CI build
15-
pub static PGLT_VERSION: LazyLock<Option<&str>> = LazyLock::new(|| option_env!("PGLT_VERSION"));
15+
pub static PGT_VERSION: LazyLock<Option<&str>> = LazyLock::new(|| option_env!("PGT_VERSION"));
1616

1717
pub struct PgLTEnv {
1818
pub pgt_log_path: PgLTEnvVariable,
1919
pub pgt_log_prefix: PgLTEnvVariable,
2020
pub pgt_config_path: PgLTEnvVariable,
2121
}
2222

23-
pub static PGLT_ENV: OnceLock<PgLTEnv> = OnceLock::new();
23+
pub static PGT_ENV: OnceLock<PgLTEnv> = OnceLock::new();
2424

2525
impl PgLTEnv {
2626
fn new() -> Self {
2727
Self {
2828
pgt_log_path: PgLTEnvVariable::new(
29-
"PGLT_LOG_PATH",
29+
"PGT_LOG_PATH",
3030
"The directory where the Daemon logs will be saved.",
3131
),
3232
pgt_log_prefix: PgLTEnvVariable::new(
33-
"PGLT_LOG_PREFIX_NAME",
33+
"PGT_LOG_PREFIX_NAME",
3434
"A prefix that's added to the name of the log. Default: `server.log.`",
3535
),
3636
pgt_config_path: PgLTEnvVariable::new(
37-
"PGLT_CONFIG_PATH",
37+
"PGT_CONFIG_PATH",
3838
"A path to the configuration file",
3939
),
4040
}
@@ -71,7 +71,7 @@ impl PgLTEnvVariable {
7171
}
7272

7373
pub fn pgt_env() -> &'static PgLTEnv {
74-
PGLT_ENV.get_or_init(PgLTEnv::new)
74+
PGT_ENV.get_or_init(PgLTEnv::new)
7575
}
7676

7777
impl Display for PgLTEnv {

crates/pgt_fs/src/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ mod os;
1818
pub struct ConfigName;
1919

2020
impl ConfigName {
21-
const PGLT_JSONC: [&'static str; 1] = ["pglt.jsonc"];
21+
const PGT_JSONC: [&'static str; 1] = ["postgrestools.jsonc"];
2222

2323
pub const fn pgt_jsonc() -> &'static str {
24-
Self::PGLT_JSONC[0]
24+
Self::PGT_JSONC[0]
2525
}
2626

2727
pub const fn file_names() -> [&'static str; 1] {
28-
Self::PGLT_JSONC
28+
Self::PGT_JSONC
2929
}
3030
}
3131

crates/pgt_fs/src/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::ConfigName;
2121
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2222
// NOTE: The order of the variants is important, the one on the top has the highest priority
2323
pub enum FileKind {
24-
/// A configuration file has the highest priority. It's usually `pglt.jsonc`
24+
/// A configuration file has the highest priority. It's usually `postgrestools.jsonc`
2525
///
2626
/// Other third-party configuration files might be added in the future
2727
Config,
@@ -173,7 +173,7 @@ impl PgLTPath {
173173
}
174174

175175
/// The priority of the file.
176-
/// - `pglt.jsonc` has the highest priority
176+
/// - `postgrestools.jsonc` has the highest priority
177177
/// - Other files are considered as files to handle
178178
fn priority(file_name: &OsStr) -> FileKinds {
179179
if file_name == ConfigName::pgt_jsonc() {

crates/pgt_lsp/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl Session {
400400
.map(|params| &params.client_capabilities)
401401
}
402402

403-
/// This function attempts to read the `pglt.jsonc` configuration file from
403+
/// This function attempts to read the `postgrestools.jsonc` configuration file from
404404
/// the root URI and update the workspace settings accordingly
405405
#[tracing::instrument(level = "trace", skip(self))]
406406
pub(crate) async fn load_workspace_settings(&self) {

crates/pgt_lsp/tests/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ async fn test_database_connection() -> Result<()> {
372372
..Default::default()
373373
});
374374
fs.insert(
375-
url!("pglt.jsonc").to_file_path().unwrap(),
375+
url!("postgrestools.jsonc").to_file_path().unwrap(),
376376
serde_json::to_string_pretty(&conf).unwrap(),
377377
);
378378

@@ -484,7 +484,7 @@ async fn test_completions() -> Result<()> {
484484
..Default::default()
485485
});
486486
fs.insert(
487-
url!("pglt.jsonc").to_file_path().unwrap(),
487+
url!("postgrestools.jsonc").to_file_path().unwrap(),
488488
serde_json::to_string_pretty(&conf).unwrap(),
489489
);
490490

crates/pgt_workspace/src/configuration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn load_config(
120120
ConfigurationPathHint::None => file_system.working_directory().unwrap_or_default(),
121121
};
122122

123-
// We first search for `pglt.jsonc`
123+
// We first search for `postgrestools.jsonc`
124124
if let Some(auto_search_result) = file_system.auto_search(
125125
&configuration_directory,
126126
ConfigName::file_names().as_slice(),

docs/checking_migrations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To run it, simply point at your migrations directory.
88
pglt check supabase/migrations
99
```
1010

11-
When you are setting it up in an existing project, you might want to ignore all migrations that are already applied. To do so, add `migrationsDir` and `after` to your `pglt.jsonc` file
11+
When you are setting it up in an existing project, you might want to ignore all migrations that are already applied. To do so, add `migrationsDir` and `after` to your `postgrestools.jsonc` file
1212

1313

1414
```json
@@ -28,5 +28,5 @@ pglt check supabase/migrations --migrations-dir="supabase/migrations" --after=17
2828

2929
This will only check migrations after the specified timestamp.
3030

31-
For pre-commit hooks and when working locally, use `--staged` to only lint files that have been staged. In CI environments, you most likely want to use `--changed` to only lint files that have been changed compared to your `vcs.default_branch` configuration. If `default_branch` is not set in your `pglt.jsonc`, use `--since=REF` to specify the base branch to compare against.
31+
For pre-commit hooks and when working locally, use `--staged` to only lint files that have been staged. In CI environments, you most likely want to use `--changed` to only lint files that have been changed compared to your `vcs.default_branch` configuration. If `default_branch` is not set in your `postgrestools.jsonc`, use `--since=REF` to specify the base branch to compare against.
3232

docs/cli_reference.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ Starts the daemon server process.
202202

203203
- **` --log-prefix-name`**=_`STRING`_ &mdash;
204204
Allows to change the prefix applied to the file name of the logs.
205-
Uses environment variable **`PGLT_LOG_PREFIX_NAME`**
205+
Uses environment variable **`PGT_LOG_PREFIX_NAME`**
206206
[default: server.log]
207207
- **` --log-path`**=_`PATH`_ &mdash;
208208
Allows to change the folder where logs are stored.
209-
Uses environment variable **`PGLT_LOG_PATH`**
209+
Uses environment variable **`PGT_LOG_PATH`**
210210
- **` --config-path`**=_`PATH`_ &mdash;
211211
Allows to set a custom file path to the configuration file, or a custom directory path to find `postgrestools.jsonc`
212-
Uses environment variable **`PGLT_LOG_PREFIX_NAME`**
212+
Uses environment variable **`PGT_LOG_PREFIX_NAME`**
213213
- **`-h`**, **`--help`** &mdash;
214214
Prints help information
215215

@@ -245,14 +245,14 @@ Acts as a server for the Language Server Protocol over stdin/stdout.
245245

246246
- **` --log-prefix-name`**=_`STRING`_ &mdash;
247247
Allows to change the prefix applied to the file name of the logs.
248-
Uses environment variable **`PGLT_LOG_PREFIX_NAME`**
248+
Uses environment variable **`PGT_LOG_PREFIX_NAME`**
249249
[default: server.log]
250250
- **` --log-path`**=_`PATH`_ &mdash;
251251
Allows to change the folder where logs are stored.
252-
Uses environment variable **`PGLT_LOG_PATH`**
252+
Uses environment variable **`PGT_LOG_PATH`**
253253
- **` --config-path`**=_`PATH`_ &mdash;
254254
Allows to set a custom file path to the configuration file, or a custom directory path to find `postgrestools.jsonc`
255-
Uses environment variable **`PGLT_CONFIG_PATH`**
255+
Uses environment variable **`PGT_CONFIG_PATH`**
256256
- **`-h`**, **`--help`** &mdash;
257257
Prints help information
258258

docs/env_variables.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
[//]: # (BEGIN ENV_VARS)
44

55

6-
### `PGLT_LOG_PATH`
6+
### `PGT_LOG_PATH`
77

88
The directory where the Daemon logs will be saved.
99

10-
### `PGLT_LOG_PREFIX_NAME`
10+
### `PGT_LOG_PREFIX_NAME`
1111

1212
A prefix that's added to the name of the log. Default: `server.log.`
1313

14-
### `PGLT_CONFIG_PATH`
14+
### `PGT_CONFIG_PATH`
1515

1616
A path to the configuration file
1717

0 commit comments

Comments
 (0)