Accessing a session variable in the .config file of the editor.
Accessing a session variable in the .config file of the editor.
davykiash
Posts: 35Questions: 13Answers: 1
Hello,
I would like to set up database credentials dynamically in the application lifecycle. Since I could not do it from the class function where am calling my editor I have opted to edit the .config file of the datatable to this
require_once('../functions/functions.php');
//get db credentials
$db_credentials = get_db_credentials($_SESSION['PAYLOAD']['tenant_uuid']);
$sql_details = array(
"type" => "Mysql",
"user" => $db_credentials['datastore_db_username'],
"pass" => $db_credentials['datastore_db_password'],
"db" => $db_credentials['datastore_db_name'],
"host" => $db_credentials['datastore_db_host'],
"dsn" => "",
"port" => "",
);
However I cannot access the session variable $_SESSION['PAYLOAD']['tenant_uuid'].
What options do I have?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I have found my solution.
I added the Database namespace to my function where I could access the session variable and set the credentials there.