我正在尝试使用Java multi-threading & Safe Publication与Laravel连接Chef API。我试图用.chef文件夹中的knife.rb数据设置我的主厨配置。我根据PHP-Chef的说明设置了客户端和密钥。但我明白了:
openssl_private_encrypt(): key param is not a valid private key
当我做dd($this->key)
时,在我的控制器中,我得到null作为回报。这是我的控制者:
protected $server;
protected $client;
protected $key;
protected $version;
public function ___construct()
{
$this->server = config('chef.server');
$this->client = config('chef.client');
$this->key = config('chef.key');
$this->version = config('chef.version');
}
/**
* Get all dns records
*/
public function index()
{
dd($this->key);
$chef = new Chef($this->server, $this->client, $this->key, $this->version);
// API request
$response = $chef->get('/');
dd($response);
}
这是我的配置chef.php
return [
'server' => 'https://172.16.0.227:443/organizations/myOrganizationsName',
'client' => 'chef-validator',
'key' => '/Users/myName/.chef/ORGANIZATION-validator.pem',
'version' => '12.7.0',
"enterprise" => false
];
答案 0 :(得分:1)
只是将其复制回来,因为我认为这是正确的,但这有点像错误的密钥路径或文件权限,以至于PHP无法读取密钥数据。