Skip to content

Commit

Permalink
chore!(config, docs): delete deprecated vector.toml code (#18795)
Browse files Browse the repository at this point in the history
* chore(config, docs): delete deprecated vector.toml code

* Update src/validate.rs

Co-authored-by: Heston Hoffman <[email protected]>

* Update src/cli.rs

Co-authored-by: Heston Hoffman <[email protected]>

* Update src/validate.rs

Co-authored-by: Heston Hoffman <[email protected]>

* Update src/cli.rs

Co-authored-by: Heston Hoffman <[email protected]>

* Update src/config/cmd.rs

Co-authored-by: Heston Hoffman <[email protected]>

* Update src/config/cmd.rs

Co-authored-by: Heston Hoffman <[email protected]>

* remove 'to be removed' entry

---------

Co-authored-by: Heston Hoffman <[email protected]>
  • Loading branch information
pront and hestonhoffman authored Oct 13, 2023
1 parent 1fb0f0d commit c8557d0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 35 deletions.
1 change: 0 additions & 1 deletion docs/DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ See [DEPRECATION.md](docs/DEPRECATION.md#process) for the process for updating t
* Support for `v1` series endpoint in the `datadog_metrics` sink should be removed.
* legacy_openssl_provider v0.34.0 OpenSSL legacy provider flag should be removed
* armv7_rpm v0.34.0 The armv7 RPM packages should be removed (replaced by armv7hl)
* yaml_migration v0.34.0 Prefer loading `/etc/vector/vector.yaml` first
7 changes: 3 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(missing_docs)]

use std::{num::NonZeroU64, path::PathBuf};

use clap::{ArgAction, CommandFactory, FromArgMatches, Parser};
Expand Down Expand Up @@ -63,10 +64,8 @@ impl Opts {
pub struct RootOpts {
/// Read configuration from one or more files. Wildcard paths are supported.
/// File format is detected from the file name.
/// If zero files are specified the deprecated default config path
/// `/etc/vector/vector.toml` will be targeted.
/// And if the aforementioned file does not exist,
/// then `/etc/vector/vector.yaml` will be used.
/// If zero files are specified, the deprecated default config path
/// `/etc/vector/vector.yaml` is targeted.
#[arg(
id = "config",
short,
Expand Down
6 changes: 2 additions & 4 deletions src/config/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ pub struct Opts {

/// Read configuration from one or more files. Wildcard paths are supported.
/// File format is detected from the file name.
/// If zero files are specified the deprecated default config path
/// `/etc/vector/vector.toml` will be targeted.
/// And if the aforementioned file does not exist,
/// then `/etc/vector/vector.yaml` will be used.
/// If zero files are specified, the deprecated default config path
/// `/etc/vector/vector.yaml` is targeted.
#[arg(
id = "config",
short,
Expand Down
22 changes: 3 additions & 19 deletions src/config/loading/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,39 +304,23 @@ where

#[cfg(not(windows))]
fn default_path() -> PathBuf {
"/etc/vector/vector.toml".into()
"/etc/vector/vector.yaml".into()
}

#[cfg(windows)]
fn default_path() -> PathBuf {
let program_files =
std::env::var("ProgramFiles").expect("%ProgramFiles% environment variable must be defined");
format!("{}\\Vector\\config\\vector.toml", program_files).into()
format!("{}\\Vector\\config\\vector.yaml", program_files).into()
}

fn default_config_paths() -> Vec<ConfigPath> {
#[cfg(not(windows))]
let default_path = default_path();

#[cfg(windows)]
let default_path = default_path();

let yaml_path = default_path.with_extension("yaml");
if default_path.exists() {
warn!("DEPRECATED Using the deprecated {:?} config path as the default config location. Vector is migrating \
to YAML as the default config format. Future Vector versions will use {:?} as the default config location.",
default_path,
yaml_path);

vec![ConfigPath::File(default_path, Some(Format::Toml))]
} else {
warn!(
"The {:?} config path does not exist. Vector will attempt to use new default {:?} instead.",
default_path, yaml_path
);

vec![ConfigPath::File(yaml_path, Some(Format::Yaml))]
}
vec![ConfigPath::File(default_path, Some(Format::Yaml))]
}

#[cfg(all(
Expand Down
2 changes: 1 addition & 1 deletion src/tap/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) async fn cmd(opts: &super::Opts, signal_rx: SignalRx) -> exitcode::Ex
Have you enabled the API?
To enable the API, add the following to your `vector.toml` config file:
To enable the API, add the following to your Vector config file:
[api]
enabled = true"},
Expand Down
2 changes: 1 addition & 1 deletion src/top/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub async fn cmd(opts: &super::Opts) -> exitcode::ExitCode {
Have you enabled the API?
To enable the API, add the following to your `vector.toml` config file:
To enable the API, add the following to your Vector config file:
[api]
enabled = true"},
Expand Down
6 changes: 3 additions & 3 deletions src/validate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(missing_docs)]

use std::{collections::HashMap, fmt, fs::remove_dir_all, path::PathBuf};

use clap::Parser;
Expand Down Expand Up @@ -53,9 +54,8 @@ pub struct Opts {

/// Any number of Vector config files to validate.
/// Format is detected from the file name.
/// If none are specified the default config path `/etc/vector/vector.toml`
/// will be targeted. And if the aforementioned file does not exist,
// then `/etc/vector/vector.yaml` will be used.
/// If none are specified, the default config path `/etc/vector/vector.yaml`
/// is targeted.
#[arg(env = "VECTOR_CONFIG", value_delimiter(','))]
pub paths: Vec<PathBuf>,

Expand Down
3 changes: 1 addition & 2 deletions website/cue/reference/configuration.cue
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,7 @@ configuration: {
title: "Location"
body: """
The location of your Vector configuration file depends on your installation method. For most Linux
based systems, the file can be found at `/etc/vector/vector.toml`. And if the aforementioned file does
not exist, then `/etc/vector/vector.yaml` will be used.
based systems, the file can be found at `/etc/vector/vector.yaml`.
All files in `/etc/vector` are user configuration files and can be safely overridden to craft your
desired Vector configuration.
Expand Down

0 comments on commit c8557d0

Please sign in to comment.