Repository: nushell/nushell
File: src/config_files.rs (Rust)

Code before:
        ConfigType::Config => "Config",
        ConfigType::Env => "Environment config",
    }
}

fn config_type_default_path(config_type: ConfigType) -> &'static str {
    match config_type {
        ConfigType::Config => "default_config.nu",
        ConfigType::Env => "default_env.nu",
    }
}

pub(crate) fn read_config_file(
    engine_state: &mut EngineState,
    stack: &mut Stack,
    config_file: Option<Spanned<String>>,
    config_type: ConfigType,
    create_scaffold: bool,
) {
    warn!(
        "read_config_file() config_file_specified: {config_file:?}, config_type: {config_type:?}",
    );

    eval_default_config(engine_state, stack, config_type);

    warn!("read_config_file() loading_defaults is_env_config: {config_type:?}");

    // Load config startup file
    if let Some(file) = config_file {
        match engine_state.cwd_as_string(Some(stack)) {
            Ok(cwd) => {
                if let Ok(path) = canonicalize_with(&file.item, cwd) {
                    eval_config_contents(path, engine_state, stack);
                } else {
                    let e = ParseError::FileNotFound(file.item, file.span);
                    report_parse_error(&StateWorkingSet::new(engine_state), &e);
                }
            }
            Err(e) => {
                report_shell_error(engine_state, &e);
            }
        }
    } else if let Some(mut config_path) = nu_path::nu_config_dir() {
        // Create config directory if it does not exist
        if !config_path.exists() {
            if let Err(err) = std::fs::create_dir_all(&config_path) {
                eprintln!("Failed to create config directory: {err}");
                return;
            }
        }


Review comment (suggestion):
```suggestion
    warn!("read_config_file() loading user config: {config_type:?}");
```

Code after:
    eval_default_config(engine_state, stack, config_kind);

    warn!("read_config_file() loading default {config_kind:?}");

    // Load config startup file
    if let Some(file) = config_file {
        match engine_state.cwd_as_string(Some(stack)) {
            Ok(cwd) => {
                if let Ok(path) = canonicalize_with(&file.item, cwd) {
                    eval_config_contents(path, engine_state, stack);
                } else {
                    let e = ParseError::FileNotFound(file.item, file.span);
                    report_parse_error(&StateWorkingSet::new(engine_state), &e);
                }
            }
            Err(e) => {
                report_shell_error(engine_state, &e);
            }
        }
    } else if let Some(mut config_path) = nu_path::nu_config_dir() {
        // Create config directory if it does not exist
        if !config_path.exists()
            && let Err(err) = std::fs::create_dir_all(&config_path)
        {
            eprintln!("Failed to create config directory: {err}");
            return;
        }

        config_path.push(config_kind.path());

        if !config_path.exists() {
            let scaffold_config_file = config_kind.scaffold();

            match create_scaffold {
                true => {
                    if let Ok(mut output) = File::create(&config_path) {
                        if write!(output, "{scaffold_config_file}").is_ok() {
                            let config_name = config_kind.name();
                            println!(
                                "{} file created at: {}",
                                config_name,
                                config_path.to_string_lossy()
                            );
                        } else {
                            eprintln!(
                                "Unable to write to {}, sourcing default file instead",
                                config_path.to_string_lossy(),
                            );
                            return;
                        }
                    } else {