From 1291c7428bd4777448592d11746bdca13629e57c Mon Sep 17 00:00:00 2001 From: Mike Feranda <26969-mferanda@users.noreply.drupalcode.org> Date: Thu, 12 Sep 2024 02:59:42 +0000 Subject: [PATCH] Issue #3473721 by mferanda: File settings issue --- src/Service/GeminiAiService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Service/GeminiAiService.php b/src/Service/GeminiAiService.php index 0a5fdf5..8e26555 100644 --- a/src/Service/GeminiAiService.php +++ b/src/Service/GeminiAiService.php @@ -36,14 +36,18 @@ class GeminiAiService { public function __construct(ConfigFactoryInterface $configFactory) { $this->configFactory = $configFactory; - // Retrieve the configuration for the module + // Retrieve the configuration for the module. $config = $configFactory->get('aidmi.settings'); + // Get the input method. + $apiInputMethod = $config->get('api_input_method'); // Initialize the API key variable. $apiKey = ''; // Check if the API key is to be retrieved from the file. if ($apiInputMethod === 'file_path') { + // Get the API key file path from the configuration. + $apiKeyFilePath = $config->get('api_key_file_path'); $siteRoot = \Drupal::root(); // Get the site root. $fullFilePath = $siteRoot . '/' . ltrim($apiKeyFilePath, '/'); // Full file path. // Check if the file exists and is readable. -- GitLab