package conf import ( "sync" "time" "cloud.o-forge.io/core/oc-lib/config" ) type Config struct { ExecutionID string PeerID string Timeout int WorkflowID string Logs string Mode string KubeHost string KubePort string KubeCA string KubeCert string KubeData string ArgoHost string // when executed in a container will replace addresses with "localhost" in their url // OCNamespace est le namespace Kubernetes où tournent les composants OpenCloud (NATS, etc.). // Utilisé pour construire le FQDN NATS accessible depuis n'importe quel namespace. // Valeur par défaut : "opencloud". NatsUrl string OCNamespace string // ScheduledTime is the wall-clock time at which the Argo workflow must be submitted. // oc-monitord completes pre-pull + infra setup first, then waits until this time. // Zero value means "submit immediately after prep". ScheduledTime time.Time } // NATSPodURL retourne l'URL NATS utilisable depuis un pod dans n'importe quel namespace. // Les pods Argo tournent dans le namespace executions_id, pas dans OCNamespace, // donc le FQDN complet est nécessaire pour atteindre le service NATS. func (c *Config) NATSPodURL() string { if config.GetConfig().NATSUrl == "" { ns := c.OCNamespace if ns == "" { ns = "opencloud" } return "nats." + ns + ".svc.cluster.local:4222" } return config.GetConfig().NATSUrl } var instance *Config var once sync.Once func GetConfig() *Config { once.Do(func() { instance = &Config{} }) return instance } func GetConfFromArgs(argument string) { }