n5i 0.11.5

Common components for n5i
Documentation
// SPDX-FileCopyrightText: 2024-2026 The n5i Project
//
// SPDX-License-Identifier: AGPL-3.0-or-later

use crate::app_stores::AppStore;
use std::collections::HashMap;
use std::sync::LazyLock;

pub const DISTRO_ID: &str = "n5i";
pub const DISTRO_NAME: &str = "n5i";
pub const APP_PRELOADER: &str = "registry.nirvati.de/nirvati/app-data-loader:v0.2.7";
pub const DISTRO_VERSION: &str = env!("CARGO_PKG_VERSION");

macro_rules! const_unwrap {
    ($expr:expr) => {
        match $expr {
            Ok(val) => val,
            Err(_) => panic!("Expected Ok(_), got Err(_)"),
        }
    };
}
// If you change your crate versions, make sure to keep this constant in sync with the upstream n5i version
pub const N5I_VERSION: semver::Version = semver::Version::new(
    const_unwrap!(u64::from_str_radix(env!("CARGO_PKG_VERSION_MAJOR"), 10)),
    const_unwrap!(u64::from_str_radix(env!("CARGO_PKG_VERSION_MINOR"), 10)),
    const_unwrap!(u64::from_str_radix(env!("CARGO_PKG_VERSION_PATCH"), 10)),
);

pub const N5I_VERSION_STRING: &str = env!("CARGO_PKG_VERSION");

#[cfg(feature = "kube")]
pub async fn get_storage_class(_kube_client: &kube::Client) -> Option<String> {
    None
}

pub static INIT_STORES: LazyLock<[AppStore; 2]> = LazyLock::new(|| {
    [
        AppStore {
            id: uuid::Uuid::new_v4(),
            src: HashMap::from([
                (
                    "repo_url".to_string(),
                    "https://gitlab.com/nirvati-ug/apps/foss.git".to_string(),
                ),
                ("branch".to_string(), "stable".to_string()),
            ]),
            ..Default::default()
        },
        AppStore {
            id: uuid::Uuid::new_v4(),
            src: HashMap::from([
                (
                    "repo_url".to_string(),
                    "https://gitlab.com/nirvati-ug/apps/essentials.git".to_string(),
                ),
                ("branch".to_string(), "stable".to_string()),
            ]),
            ..Default::default()
        },
    ]
});