diff --git a/crates/pgt_cli/src/commands/clean.rs b/crates/pgt_cli/src/commands/clean.rs
index 90bfb915c..7f69fda64 100644
--- a/crates/pgt_cli/src/commands/clean.rs
+++ b/crates/pgt_cli/src/commands/clean.rs
@@ -1,12 +1,12 @@
use crate::commands::daemon::default_pgt_log_path;
use crate::{CliDiagnostic, CliSession};
-use pgt_env::pgt_env;
+use pgt_env::pgls_env;
use std::fs::{create_dir, remove_dir_all};
use std::path::PathBuf;
/// Runs the clean command
pub fn clean(_cli_session: CliSession) -> Result<(), CliDiagnostic> {
- let logs_path = pgt_env()
+ let logs_path = pgls_env()
.pgt_log_path
.value()
.map_or(default_pgt_log_path(), PathBuf::from);
diff --git a/crates/pgt_cli/src/commands/daemon.rs b/crates/pgt_cli/src/commands/daemon.rs
index 988286f46..f64e5b25d 100644
--- a/crates/pgt_cli/src/commands/daemon.rs
+++ b/crates/pgt_cli/src/commands/daemon.rs
@@ -5,7 +5,7 @@ use crate::{
use pgt_console::{ConsoleExt, markup};
use pgt_lsp::ServerFactory;
use pgt_workspace::{TransportError, WorkspaceError, workspace::WorkspaceClient};
-use std::{env, path::PathBuf};
+use std::path::PathBuf;
use tokio::io;
use tokio::runtime::Runtime;
use tracing::subscriber::Interest;
@@ -234,7 +234,12 @@ fn setup_tracing_subscriber(
}
pub fn default_pgt_log_path() -> PathBuf {
- match env::var_os("PGT_LOG_PATH") {
+ let env = pgt_env::pgls_env();
+ match env
+ .pgls_log_path
+ .value()
+ .or_else(|| env.pgt_log_path.value())
+ {
Some(directory) => PathBuf::from(directory),
None => pgt_fs::ensure_cache_dir().join("pgt-logs"),
}
diff --git a/crates/pgt_cli/src/commands/mod.rs b/crates/pgt_cli/src/commands/mod.rs
index 1457cf77e..d66b27ba8 100644
--- a/crates/pgt_cli/src/commands/mod.rs
+++ b/crates/pgt_cli/src/commands/mod.rs
@@ -73,6 +73,7 @@ pub enum PgtCommand {
/// Allows to change the prefix applied to the file name of the logs.
#[bpaf(
env("PGT_LOG_PREFIX_NAME"),
+ env("PGLS_LOG_PREFIX_NAME"),
long("log-prefix-name"),
argument("STRING"),
hide_usage,
@@ -84,6 +85,7 @@ pub enum PgtCommand {
/// Allows to change the folder where logs are stored.
#[bpaf(
env("PGT_LOG_PATH"),
+ env("PGLS_LOG_PATH"),
long("log-path"),
argument("PATH"),
hide_usage,
@@ -115,6 +117,7 @@ pub enum PgtCommand {
/// Allows to change the prefix applied to the file name of the logs.
#[bpaf(
env("PGT_LOG_PREFIX_NAME"),
+ env("PGLS_LOG_PREFIX_NAME"),
long("log-prefix-name"),
argument("STRING"),
hide_usage,
@@ -125,6 +128,7 @@ pub enum PgtCommand {
/// Allows to change the folder where logs are stored.
#[bpaf(
env("PGT_LOG_PATH"),
+ env("PGLS_LOG_PATH"),
long("log-path"),
argument("PATH"),
hide_usage,
@@ -154,6 +158,7 @@ pub enum PgtCommand {
/// Allows to change the prefix applied to the file name of the logs.
#[bpaf(
env("PGT_LOG_PREFIX_NAME"),
+ env("PGLS_LOG_PREFIX_NAME"),
long("log-prefix-name"),
argument("STRING"),
hide_usage,
@@ -165,6 +170,7 @@ pub enum PgtCommand {
/// Allows to change the folder where logs are stored.
#[bpaf(
env("PGT_LOG_PATH"),
+ env("PGLS_LOG_PATH"),
long("log-path"),
argument("PATH"),
hide_usage,
@@ -175,6 +181,7 @@ pub enum PgtCommand {
/// Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level.
#[bpaf(
env("PGT_LOG_LEVEL"),
+ env("PGLS_LOG_LEVEL"),
long("log-level"),
argument("trace|debug|info|warn|error|none"),
fallback(String::from("debug"))
@@ -184,6 +191,7 @@ pub enum PgtCommand {
/// Allows to change the logging format kind. Default is hierarchical.
#[bpaf(
env("PGT_LOG_KIND"),
+ env("PGLS_LOG_KIND"),
long("log-kind"),
argument("hierarchical|bunyan"),
fallback(String::from("hierarchical"))
diff --git a/crates/pgt_configuration/src/lib.rs b/crates/pgt_configuration/src/lib.rs
index c5e8b9f1a..4dde88a37 100644
--- a/crates/pgt_configuration/src/lib.rs
+++ b/crates/pgt_configuration/src/lib.rs
@@ -33,7 +33,7 @@ use files::{FilesConfiguration, PartialFilesConfiguration, partial_files_configu
use migrations::{
MigrationsConfiguration, PartialMigrationsConfiguration, partial_migrations_configuration,
};
-use pgt_env::PGT_WEBSITE;
+use pgt_env::PGLS_WEBSITE;
use plpgsql_check::{
PartialPlPgSqlCheckConfiguration, PlPgSqlCheckConfiguration,
partial_pl_pg_sql_check_configuration,
@@ -103,7 +103,7 @@ impl PartialConfiguration {
/// Returns the initial configuration.
pub fn init() -> Self {
Self {
- schema: Some(format!("{}/schemas/{VERSION}/schema.json", PGT_WEBSITE)),
+ schema: Some(format!("{}/schemas/{VERSION}/schema.json", PGLS_WEBSITE)),
extends: Some(StringSet::default()),
files: Some(PartialFilesConfiguration {
ignore: Some(Default::default()),
diff --git a/crates/pgt_env/src/lib.rs b/crates/pgt_env/src/lib.rs
index 918a6d1cd..3b2f50fcf 100644
--- a/crates/pgt_env/src/lib.rs
+++ b/crates/pgt_env/src/lib.rs
@@ -1,4 +1,4 @@
-//! Environment variables and configuration constants for Postgres Tools.
+//! Environment variables and configuration constants for Postgres Language Server.
//!
//! This module provides:
//! - Environment variable definitions for runtime configuration
@@ -10,13 +10,14 @@ use pgt_console::{DebugDisplay, KeyValuePair, markup};
use std::env;
use std::sync::{LazyLock, OnceLock};
-/// Returns `true` if this is an unstable build of Postgres Tools
+/// Returns `true` if this is an unstable build of Postgres Language Server
pub fn is_unstable() -> bool {
VERSION == "0.0.0"
}
-/// The internal version of Postgres Tools. This is usually supplied during the CI build
-pub static PGT_VERSION: LazyLock