Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Default Paths to Proper Files #618

Open
Kelerchian opened this issue Dec 12, 2023 · 2 comments
Open

Move Default Paths to Proper Files #618

Kelerchian opened this issue Dec 12, 2023 · 2 comments
Labels

Comments

@Kelerchian
Copy link
Contributor

I forgot to reply. I don't think addressing this right now is pertinent, though I agree. Both this and the previous issue you outlined are relevant but a bit outside the scope of this PR. Should we open an issue?

Originally posted by @jmg-duarte in #615 (comment)

@jmg-duarte
Copy link
Contributor

The function in question is used in two places:

fn default_user_identity_dir() -> ActyxOSResult<PathBuf> {
let p = get_data_dir()?;
Ok(p.join("keys").join("users"))
}

pub fn load_dev_cert(path: Option<PathBuf>) -> ActyxOSResult<DeveloperCertificate> {
let path = path
.ok_or(())
.or_else(|_| ActyxOSResult::Ok(get_data_dir()?.join("certs").join("default")))?;
let s = fs::read_to_string(path.as_path()).ax_err_ctx(
ActyxOSCode::ERR_IO,
format!("failed to read developer certificate at {}", path.display()),
)?;
serde_json::from_str(&s).ax_err_ctx(ActyxOSCode::ERR_INVALID_INPUT, "reading developer certificate")
}

As you can see, both are placed in the same file.

Although, the first one is only used inside that file and the second one is only used outside the file. In ax to be precise.

I'm open to ideas, but the way this is used right now seems sensible to me, as it is done for OS defaults only.

@Kelerchian
Copy link
Contributor Author

as it is done for OS defaults only.

By this, do you mean that we are sure that these functions will be called only on certain platforms so that we are safe?

If I remember correctly, this issue (and my initial comment) stems from the idea that MAYBE it ax_core could be slowly made into a no_std lib and therefore these default paths should move to ax rather than ax_core.
But I'm not sure if it makes sense, making it no_std in the first place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants