Ensure that the tenant name and the application name are the same #95

Open
opened 2025-08-04 20:41:43 +00:00 by letian · 0 comments
Owner

Personal opinion, but I'm not even sure the end user should have to worry about providing names for the tenant, the application, or any other scores. It would be simpler if there is one "global" name for the whole configuration.

Something like this:

    let tenant = TenantScore {
        config: TenantConfig {
            id: Id::from_str("test-tenant-id"),
            ..Default::default()
        },
    };

    let application = Arc::new(RustWebapp {
        domain: Url::Url(url::Url::parse("https://rustapp.harmony.example.com").unwrap()),
        project_root: PathBuf::from("./examples/rust/webapp"),
        framework: Some(RustWebFramework::Leptos),
    });

    let webhook_receiver = WebhookReceiver {
        url: Url::Url(url::Url::parse("https://webhook-doesnt-exist.com").unwrap()),
    };

    let app = ApplicationScore {
        features: vec![Box::new(Monitoring {
            alert_receiver: vec![Box::new(webhook_receiver)],
            application: application.clone(),
        })],
        application,
    };

    harmony_cli::run(
        "example-monitoring",
        K8sAnywhereTopology::from_env(), 
        Inventory::autoload(), 
        vec![Box::new(tenant), Box::new(app)],
        None
    ).await.unwrap();

That would simplify the setup and we would be able to enforce that the tenant name is the same as the application name behind the scene.

Originally posted by @letian in https://git.nationtech.io/NationTech/harmony/pulls/86/files#issuecomment-1760

Personal opinion, but I'm not even sure the end user should have to worry about providing names for the tenant, the application, or any other scores. It would be simpler if there is one "global" name for the whole configuration. Something like this: ```rs let tenant = TenantScore { config: TenantConfig { id: Id::from_str("test-tenant-id"), ..Default::default() }, }; let application = Arc::new(RustWebapp { domain: Url::Url(url::Url::parse("https://rustapp.harmony.example.com").unwrap()), project_root: PathBuf::from("./examples/rust/webapp"), framework: Some(RustWebFramework::Leptos), }); let webhook_receiver = WebhookReceiver { url: Url::Url(url::Url::parse("https://webhook-doesnt-exist.com").unwrap()), }; let app = ApplicationScore { features: vec![Box::new(Monitoring { alert_receiver: vec![Box::new(webhook_receiver)], application: application.clone(), })], application, }; harmony_cli::run( "example-monitoring", K8sAnywhereTopology::from_env(), Inventory::autoload(), vec![Box::new(tenant), Box::new(app)], None ).await.unwrap(); ``` That would simplify the setup and we would be able to enforce that the tenant name is the same as the application name behind the scene. _Originally posted by @letian in https://git.nationtech.io/NationTech/harmony/pulls/86/files#issuecomment-1760_
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: NationTech/harmony#95
No description provided.