mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Fix the compilation
This commit is contained in:
parent
a109802d45
commit
a3cf104736
@ -310,6 +310,7 @@ pub const MASTER_KEY_MIN_SIZE: usize = 16;
|
|||||||
const MASTER_KEY_GEN_SIZE: usize = 32;
|
const MASTER_KEY_GEN_SIZE: usize = 32;
|
||||||
|
|
||||||
pub fn generate_master_key() -> String {
|
pub fn generate_master_key() -> String {
|
||||||
|
use base64::Engine;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
|
||||||
@ -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.
|
// 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.
|
// 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)
|
||||||
}
|
}
|
||||||
|
@ -323,10 +323,10 @@ impl Opt {
|
|||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| PathBuf::from(DEFAULT_CONFIG_FILE_PATH));
|
.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) => {
|
Ok(config) => {
|
||||||
// If the file is successfully read, we deserialize it with `toml`.
|
// 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'
|
// 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)
|
// 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() {
|
if opt_from_config.config_file_path.is_some() {
|
||||||
|
Loading…
Reference in New Issue
Block a user