Rename dirs to config
This commit is contained in:
parent
6c6d5a51a8
commit
a792007abd
3 changed files with 6 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ const APPLICATION: &str = "AzireVPN";
|
|||
|
||||
static PROJECT_DIRS: OnceCell<ProjectDirs> = OnceCell::new();
|
||||
|
||||
pub(crate) fn get_data_dir() -> PathBuf {
|
||||
fn get_data_dir() -> PathBuf {
|
||||
let project_dirs = PROJECT_DIRS.get_or_init(|| {
|
||||
ProjectDirs::from(QUALIFIER, ORGANIZATION, APPLICATION)
|
||||
.expect("cannot get project data dir")
|
||||
|
|
@ -4,7 +4,7 @@ use x25519_dalek::{PublicKey, StaticSecret};
|
|||
|
||||
use std::{io::Write, path::Path};
|
||||
|
||||
use crate::dirs::MachineConfig;
|
||||
use crate::config::MachineConfig;
|
||||
|
||||
const KEY_SIZE: usize = 32;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
mod api;
|
||||
mod dirs;
|
||||
mod config;
|
||||
mod keys;
|
||||
|
||||
use std::io::Write;
|
||||
|
|
@ -9,7 +9,7 @@ use std::path::PathBuf;
|
|||
use clap::{Parser, Subcommand};
|
||||
use log::debug;
|
||||
|
||||
use crate::{keys::{get_keys, WireguardKeyPair}, dirs::MachineConfig};
|
||||
use crate::{keys::{get_keys, WireguardKeyPair}, config::MachineConfig};
|
||||
|
||||
/// AzireVPN client
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
@ -75,14 +75,14 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
}
|
||||
|
||||
fn login(opts: &Opts, login_opts: &LoginOpts) -> Result<(), anyhow::Error> {
|
||||
let machine_config = dirs::MachineConfig::new(opts.machine.as_ref())?;
|
||||
let machine_config = config::MachineConfig::new(opts.machine.as_ref())?;
|
||||
std::fs::write(machine_config.username_path(), &login_opts.username)?;
|
||||
std::fs::write(machine_config.token_path(), &login_opts.token)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn logout(opts: &Opts) -> Result<(), anyhow::Error> {
|
||||
let machine_config = dirs::MachineConfig::new(opts.machine.as_ref())?;
|
||||
let machine_config = config::MachineConfig::new(opts.machine.as_ref())?;
|
||||
machine_config.destroy()?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue