0

Hi I am using chef for deployment automation of a wordpress site where in I need to read database, host, username and password from my shared.yml for wp-config.php so I am trying below code in my template file

<?php
define('DB_NAME', '"<%= @database %>"');
define('DB_USER', '"<%= @username %>"');
define('DB_PASSWORD', '"<%= @password %>"');
define('DB_HOST', '"<% @host %>"');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
?>

however the interpolation isn't taking place in where it should take actual values that are defined in _shared.yml. My attributes in chef looks like below.

default[:example_wp][:database][:host]          = ""
default[:example_wp][:database][:adapter]       = "mysql2"
default[:example_wp][:database][:database]      = "wordpress"
default[:example_wp][:database][:username]      = "wordpress"
default[:example_wp][:database][:password]      = ""

Can someone help with interpolation that I am trying.

Thanks.

Shailesh Sutar
  • 1,427
  • 4
  • 22
  • 40

0 Answers0