diff --git a/README.md b/README.md index c263159..53e1de1 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ ## Features - **Modes**: The runner can be started in different modes which either offer full functionality or just be a standby listener for incoming alerts -- **Plugins**: Develop your own plugins or use our existing ones to extend the functionality of this runner and alertflow / exflow to your needs +- **Plugins**: Develop your own plugins or use our existing ones to extend the functionality of this Runner and JustFlow to your needs ## Configuration -To conntect an runner to exFlow or AlertFlow you first have to set them up and copy the runner_id and or the api key from the created project. As an Admin you can copy the Global Share Runner token from the admin view. +To conntect an runner to JustFlow you first have to set them up and copy the runner_id and or the api key from the created project. As an Admin you can copy the Global Share Runner token from the admin view. ```yaml --- @@ -25,15 +25,9 @@ To conntect an runner to exFlow or AlertFlow you first have to set them up and c log_level: info mode: master -alertflow: +justflow: enabled: true - url: https://alertflow.org - runner_id: null - api_key: null - -exflow: - enabled: true - url: https://exflow.org + url: https://justflow.app runner_id: null api_key: null diff --git a/config/config.go b/config/config.go index c1fe1fc..b464200 100644 --- a/config/config.go +++ b/config/config.go @@ -21,7 +21,7 @@ type ConfigurationManager struct { type Config struct { LogLevel string `mapstructure:"log_level" validate:"required,oneof=debug info warn error"` Mode string `mapstructure:"mode" validate:"required,oneof=master worker"` - ExFlow exflowConfig `mapstructure:"exflow" validate:"required"` + JustFlow justflowConfig `mapstructure:"justflow" validate:"required"` ApiEndpoint ApiEndpointConfig `mapstructure:"api_endpoint" validate:"required"` WorkspaceDir string `mapstructure:"workspace_dir" validate:"dir"` PluginDir string `mapstructure:"plugin_dir" validate:"dir"` @@ -29,7 +29,7 @@ type Config struct { Runner RunnerConf `mapstructure:"runner"` } -type exflowConfig struct { +type justflowConfig struct { URL string `mapstructure:"url" validate:"required,url"` RunnerID string `mapstructure:"runner_id"` APIKey string `mapstructure:"api_key"` @@ -161,11 +161,11 @@ func (cm *ConfigurationManager) setDefaults(config *Config) { } func (cm *ConfigurationManager) validateConfig(config *Config) error { - if config.ExFlow.APIKey == "" && config.Runner.SharedRunnerSecret == "" { - return fmt.Errorf("exflow.api_key or runner.shared_runner_secret is required") + if config.JustFlow.APIKey == "" && config.Runner.SharedRunnerSecret == "" { + return fmt.Errorf("justflow.api_key or runner.shared_runner_secret is required") } - if config.ExFlow.URL == "" { - return fmt.Errorf("exflow URL is required") + if config.JustFlow.URL == "" { + return fmt.Errorf("justflow URL is required") } return nil @@ -182,28 +182,28 @@ func (cm *ConfigurationManager) GetConfig() *Config { func (cm *ConfigurationManager) UpdateRunnerID(id string) { cm.mu.Lock() defer cm.mu.Unlock() - cm.config.ExFlow.RunnerID = id + cm.config.JustFlow.RunnerID = id } // UpdateRunnerApiKey updates the runner api_key in the configuration for both Alertflow and ExFlow func (cm *ConfigurationManager) UpdateRunnerApiKey(apiKey string) { cm.mu.Lock() defer cm.mu.Unlock() - cm.config.ExFlow.APIKey = apiKey + cm.config.JustFlow.APIKey = apiKey } // GetRunnerIDs returns the current runner IDs for both Alertflow and ExFlow func (cm *ConfigurationManager) GetRunnerID() string { cm.mu.RLock() defer cm.mu.RUnlock() - return cm.config.ExFlow.RunnerID + return cm.config.JustFlow.RunnerID } // GetRunnerIDs returns the current runner apiKey for both Alertflow and ExFlow func (cm *ConfigurationManager) GetRunnerApiKey() string { cm.mu.RLock() defer cm.mu.RUnlock() - return cm.config.ExFlow.APIKey + return cm.config.JustFlow.APIKey } // ReloadConfig reloads the configuration from the file diff --git a/internal/executions/start_processing.go b/internal/executions/start_processing.go index a2598ab..042c53e 100644 --- a/internal/executions/start_processing.go +++ b/internal/executions/start_processing.go @@ -8,7 +8,7 @@ import ( jf_models "github.com/JustLABv1/justflow/services/backend/pkg/models" "github.com/google/uuid" "github.com/v1Flows/runner/config" - internal_exflow "github.com/v1Flows/runner/internal/exflow" + internal_justflow "github.com/v1Flows/runner/internal/justflow" "github.com/v1Flows/runner/internal/runner" "github.com/v1Flows/runner/pkg/executions" "github.com/v1Flows/runner/pkg/plugins" @@ -67,7 +67,7 @@ func startProcessing(actions []jf_models.Action, loadedPlugins map[string]plugin // send initial step var initialSteps []jf_models.ExecutionSteps - initialSteps, err = internal_exflow.SendInitialSteps(cfg, actions, execution) + initialSteps, err = internal_justflow.SendInitialSteps(cfg, actions, execution) if err != nil { executions.EndWithError(nil, execution) // Stop heartbeats and finish processing diff --git a/internal/exflow/send_initial_steps.go b/internal/justflow/send_initial_steps.go similarity index 98% rename from internal/exflow/send_initial_steps.go rename to internal/justflow/send_initial_steps.go index bcdd02e..72acff7 100644 --- a/internal/exflow/send_initial_steps.go +++ b/internal/justflow/send_initial_steps.go @@ -1,4 +1,4 @@ -package internal_exflow +package internal_justflow import ( "time" diff --git a/pkg/alerts/get_data.go b/pkg/alerts/get_data.go index 09a9c5a..8170775 100644 --- a/pkg/alerts/get_data.go +++ b/pkg/alerts/get_data.go @@ -22,13 +22,13 @@ func GetData(cfg *config.Config, alertID string) (models.Alerts, error) { }, } - url := cfg.ExFlow.URL + "/api/v1/alerts/" + alertID + url := cfg.JustFlow.URL + "/api/v1/alerts/" + alertID req, err := http.NewRequest("GET", url, nil) if err != nil { log.Errorf("Failed to create request: %v", err) return models.Alerts{}, err } - req.Header.Set("Authorization", cfg.ExFlow.APIKey) + req.Header.Set("Authorization", cfg.JustFlow.APIKey) resp, err := client.Do(req) if err != nil { log.Error(err) diff --git a/pkg/alerts/get_grouped_alerts.go b/pkg/alerts/get_grouped_alerts.go index 325960c..589c47b 100644 --- a/pkg/alerts/get_grouped_alerts.go +++ b/pkg/alerts/get_grouped_alerts.go @@ -30,13 +30,13 @@ func GetGroupedAlerts(cfg *config.Config, flowID string, groupKeyIdentifier stri payloadBuf := new(bytes.Buffer) json.NewEncoder(payloadBuf).Encode(request) - url := cfg.ExFlow.URL + "/api/v1/alerts/grouped" + url := cfg.JustFlow.URL + "/api/v1/alerts/grouped" req, err := http.NewRequest("GET", url, payloadBuf) if err != nil { log.Errorf("Failed to create request: %v", err) return []models.Alerts{}, err } - req.Header.Set("Authorization", cfg.ExFlow.APIKey) + req.Header.Set("Authorization", cfg.JustFlow.APIKey) resp, err := client.Do(req) if err != nil { log.Error(err) diff --git a/pkg/alerts/send_alert.go b/pkg/alerts/send_alert.go index d03a146..799b6bb 100644 --- a/pkg/alerts/send_alert.go +++ b/pkg/alerts/send_alert.go @@ -21,12 +21,12 @@ func SendAlert(cfg *config.Config, alert models.Alerts) (err error) { } // Add authorization - req, err := http.NewRequest("POST", cfg.ExFlow.URL+"/api/v1/alerts/", bytes.NewReader(jsonPayload)) + req, err := http.NewRequest("POST", cfg.JustFlow.URL+"/api/v1/alerts/", bytes.NewReader(jsonPayload)) if err != nil { log.Error(err) return } - req.Header.Set("Authorization", cfg.ExFlow.APIKey) + req.Header.Set("Authorization", cfg.JustFlow.APIKey) client := &http.Client{} res, err := client.Do(req) diff --git a/pkg/alerts/update_alert.go b/pkg/alerts/update_alert.go index de560bd..8ecee8a 100644 --- a/pkg/alerts/update_alert.go +++ b/pkg/alerts/update_alert.go @@ -21,12 +21,12 @@ func UpdateAlert(cfg *config.Config, alert models.Alerts) { } // Add authorization - req, err := http.NewRequest("PUT", cfg.ExFlow.URL+"/api/v1/alerts/"+alert.ID.String(), bytes.NewReader(jsonPayload)) + req, err := http.NewRequest("PUT", cfg.JustFlow.URL+"/api/v1/alerts/"+alert.ID.String(), bytes.NewReader(jsonPayload)) if err != nil { log.Error(err) return } - req.Header.Set("Authorization", cfg.ExFlow.APIKey) + req.Header.Set("Authorization", cfg.JustFlow.APIKey) client := &http.Client{} res, err := client.Do(req) diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go index 98c5128..03a42f6 100644 --- a/pkg/platform/platform.go +++ b/pkg/platform/platform.go @@ -11,7 +11,7 @@ func GetPlatformConfig(cfg *config.Config) (string, string, string) { cfg = configManager.GetConfig() } - return cfg.ExFlow.URL, cfg.ExFlow.APIKey, cfg.ExFlow.RunnerID + return cfg.JustFlow.URL, cfg.JustFlow.APIKey, cfg.JustFlow.RunnerID } func GetPlatformConfigPlain(cfg *config.Config) (string, string) { @@ -21,5 +21,5 @@ func GetPlatformConfigPlain(cfg *config.Config) (string, string) { cfg = configManager.GetConfig() } - return cfg.ExFlow.URL, cfg.ExFlow.APIKey + return cfg.JustFlow.URL, cfg.JustFlow.APIKey }