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

Question: Is there a way to embed config files? #408

Closed
bryantbiggs opened this issue Dec 28, 2022 · 1 comment
Closed

Question: Is there a way to embed config files? #408

bryantbiggs opened this issue Dec 28, 2022 · 1 comment

Comments

@bryantbiggs
Copy link

If I am distributing a CLI, the executable currently fails because the config files do not travel with the binary. I don't know if I am missing something obvious but is there a way to embed the configuration files referenced? Something like

use config::{Config, ConfigError, File};
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "assets/"]
struct Asset;

let s = Config::builder().add_source(File::with_name("assets/config.yaml")).build()?;
s.try_deserialize()
@matthiasbeyer
Copy link
Member

matthiasbeyer commented Dec 29, 2022

You're already using rust_embed up there, that already embeds the file in your binary. You just have to use it from there!

@matthiasbeyer matthiasbeyer closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants