Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

home dir #23

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ tracing = "0.1.37"
tungstenite = "0.20.0"
url = "2.4.1"
uuid = "1.4.1"
dirs = "5.0.1"
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use golem_examples::model::{ExampleName, GuestLanguage, GuestLanguageTier, Packa
use model::*;
use reqwest::Url;
use serde::Serialize;
use tracing::debug;
use uuid::Uuid;

use crate::account::{AccountHandler, AccountHandlerLive, AccountSubcommand};
Expand Down Expand Up @@ -244,10 +245,15 @@ async fn async_main(cmd: GolemCommand) -> Result<(), Box<dyn std::error::Error>>
let url_str =
std::env::var("GOLEM_BASE_URL").unwrap_or("https://release.api.golem.cloud/".to_string());
let url = Url::parse(&url_str).unwrap();
let home = std::env::var("HOME").unwrap();
let home = dirs::home_dir().unwrap();
let allow_insecure_str = std::env::var("GOLEM_ALLOW_INSECURE").unwrap_or("false".to_string());
let allow_insecure = allow_insecure_str != "false";
let default_conf_dir = PathBuf::from(format!("{home}/.golem"));
let default_conf_dir = home.join(".golem");

debug!(
"Golem configuration directory: {}",
default_conf_dir.display()
);

let login = LoginClientLive {
login: golem_client::login::LoginLive {
Expand Down