mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-09 03:57:39 +00:00
Fix .env.toml
paths (#15645)
This PR fixes the `.env.toml` paths, since we inadvertently broke them in https://github.com/zed-industries/zed/pull/15557. There's likely a better way we can do this, but I wanted to restore the previous behavior, for now. Release Notes: - N/A
This commit is contained in:
parent
4bfb8fda8d
commit
60127f2a8d
2 changed files with 8 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
use collab::env::get_dotenv_vars;
|
use collab::env::get_dotenv_vars;
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
for (key, value) in get_dotenv_vars()? {
|
for (key, value) in get_dotenv_vars(".")? {
|
||||||
println!("export {}=\"{}\"", key, value);
|
println!("export {}=\"{}\"", key, value);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub fn get_dotenv_vars(current_dir: impl AsRef<Path>) -> Result<Vec<(String, String)>> {
|
||||||
|
let current_dir = current_dir.as_ref();
|
||||||
|
|
||||||
pub fn get_dotenv_vars() -> Result<Vec<(String, String)>> {
|
|
||||||
let mut vars = Vec::new();
|
let mut vars = Vec::new();
|
||||||
let env_content = fs::read_to_string("./crates/collab/.env.toml")
|
let env_content = fs::read_to_string(current_dir.join(".env.toml"))
|
||||||
.map_err(|_| anyhow!("no .env.toml file found"))?;
|
.map_err(|_| anyhow!("no .env.toml file found"))?;
|
||||||
|
|
||||||
add_vars(env_content, &mut vars)?;
|
add_vars(env_content, &mut vars)?;
|
||||||
|
|
||||||
if let Ok(secret_content) = fs::read_to_string("./crates/collab/.env.secret.toml") {
|
if let Ok(secret_content) = fs::read_to_string(current_dir.join(".env.secret.toml")) {
|
||||||
add_vars(secret_content, &mut vars)?;
|
add_vars(secret_content, &mut vars)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +19,7 @@ pub fn get_dotenv_vars() -> Result<Vec<(String, String)>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_dotenv() -> Result<()> {
|
pub fn load_dotenv() -> Result<()> {
|
||||||
for (key, value) in get_dotenv_vars()? {
|
for (key, value) in get_dotenv_vars("./crates/collab")? {
|
||||||
std::env::set_var(key, value);
|
std::env::set_var(key, value);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue