Skip to content

Commit

Permalink
Fix the compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollmops committed Apr 24, 2023
1 parent a109802 commit a3cf104
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion meilisearch-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ pub const MASTER_KEY_MIN_SIZE: usize = 16;
const MASTER_KEY_GEN_SIZE: usize = 32;

pub fn generate_master_key() -> String {
use base64::Engine;
use rand::rngs::OsRng;
use rand::RngCore;

Expand All @@ -320,5 +321,5 @@ pub fn generate_master_key() -> String {

// let's encode the random bytes to base64 to make them human-readable and not too long.
// We're using the URL_SAFE alphabet that will produce keys without =, / or other unusual characters.
base64::encode_config(buf, base64::URL_SAFE_NO_PAD)
base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(buf)
}
4 changes: 2 additions & 2 deletions meilisearch/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ impl Opt {
.clone()
.unwrap_or_else(|| PathBuf::from(DEFAULT_CONFIG_FILE_PATH));

match std::fs::read(&config_file_path) {
match std::fs::read_to_string(&config_file_path) {
Ok(config) => {
// If the file is successfully read, we deserialize it with `toml`.
let opt_from_config = toml::from_slice::<Opt>(&config)?;
let opt_from_config = toml::from_str::<Opt>(&config)?;
// Return an error if config file contains 'config_file_path'
// Using that key in the config file doesn't make sense bc it creates a logical loop (config file referencing itself)
if opt_from_config.config_file_path.is_some() {
Expand Down

0 comments on commit a3cf104

Please sign in to comment.