From fb3d9963ff2c82420f037d75b68f56407637845b Mon Sep 17 00:00:00 2001 From: Ruben Rafael Danielle Date: Tue, 10 Oct 2023 15:34:58 -0300 Subject: [PATCH] Feature EML-365: Synchronize with develop and get env vars from props --- src/main/groovy/com/etendoerp/copilot/Constants.groovy | 6 +++--- .../etendoerp/copilot/dockerenv/CopilotStart.groovy | 10 +--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/groovy/com/etendoerp/copilot/Constants.groovy b/src/main/groovy/com/etendoerp/copilot/Constants.groovy index 183dc6c..c30a480 100644 --- a/src/main/groovy/com/etendoerp/copilot/Constants.groovy +++ b/src/main/groovy/com/etendoerp/copilot/Constants.groovy @@ -9,9 +9,9 @@ class Constants { static final String MODULES_PROJECT = "modules" static final String COPILOT_MODULE = "com.etendoerp.copilot" static final String PKG_PROPERTY = "pkg" - static final String COPILOT_PORT_PROPERTY = "copilotPort" - static final String OPENAI_API_KEY_PROPERTY = "openaiAPIKey" - static final String BASTIAN_URL_PROPERTY = "bastianPort" + static final String COPILOT_PORT_PROPERTY = "COPILOT_PORT" + static final String OPENAI_API_KEY_PROPERTY = "OPENAI_API_KEY" + static final String BASTIAN_URL_PROPERTY = "BASTIAN_URL" static final String COPILOT_DOCKER_REPO = "etendo_copilot_core" static final String TOOLS_CONFIG_FILE = "tools_config.json" } diff --git a/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy b/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy index f510b73..494f139 100644 --- a/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy +++ b/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy @@ -14,17 +14,9 @@ class CopilotStart { project.logger.info("* Performing copilot start task.") project.logger.info("*****************************************************") - String openaiApiKey = project.ext.get(Constants.OPENAI_API_KEY_PROPERTY) String copilotPort = project.ext.get(Constants.COPILOT_PORT_PROPERTY) - String bastianUrl = null - try { - bastianUrl = project.ext.get(Constants.BASTIAN_URL_PROPERTY) - } catch (ignored) {} - String dockerEnvVars = 'docker run -e OPENAI_API_KEY=' + "\"${openaiApiKey}\"" + ' -e COPILOT_PORT=' + "\"${copilotPort}\"" - if (bastianUrl) - dockerEnvVars += ' -e BASTIAN_URL=' + "\"${bastianUrl}\"" - String dockerCommand = dockerEnvVars + ' -p ' + "${copilotPort}" + ':' + "${copilotPort}" + + String dockerCommand = 'docker run --env-file=\$(pwd)/gradle.properties -p ' + "${copilotPort}" + ':' + "${copilotPort}" + ' -v ' + "${project.buildDir.path}/copilot/:/app/ " + '-v ' + "\$(pwd)/modules:/modules/ etendo/${Constants.COPILOT_DOCKER_REPO}:develop"