Skip to content
Snippets Groups Projects
Commit 1291c742 authored by Mike Feranda's avatar Mike Feranda
Browse files

Issue #3473721 by mferanda: File settings issue

parent 0433f8a5
No related branches found
No related tags found
No related merge requests found
...@@ -36,14 +36,18 @@ class GeminiAiService { ...@@ -36,14 +36,18 @@ class GeminiAiService {
public function __construct(ConfigFactoryInterface $configFactory) { public function __construct(ConfigFactoryInterface $configFactory) {
$this->configFactory = $configFactory; $this->configFactory = $configFactory;
// Retrieve the configuration for the module // Retrieve the configuration for the module.
$config = $configFactory->get('aidmi.settings'); $config = $configFactory->get('aidmi.settings');
// Get the input method.
$apiInputMethod = $config->get('api_input_method');
// Initialize the API key variable. // Initialize the API key variable.
$apiKey = ''; $apiKey = '';
// Check if the API key is to be retrieved from the file. // Check if the API key is to be retrieved from the file.
if ($apiInputMethod === 'file_path') { 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. $siteRoot = \Drupal::root(); // Get the site root.
$fullFilePath = $siteRoot . '/' . ltrim($apiKeyFilePath, '/'); // Full file path. $fullFilePath = $siteRoot . '/' . ltrim($apiKeyFilePath, '/'); // Full file path.
// Check if the file exists and is readable. // Check if the file exists and is readable.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment