thinkingcircles/flaredns-client

同步您的App动态IP与CloudFlare DNS的A记录。

1.0.2 2017-07-08 06:35 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:17:12 UTC


README

同步您的App动态IP与CloudFlare DNS的A记录。

如果使用以下情况,请使用此包:

  • 您使用CloudFlare
  • 您在具有动态IP的服务器上运行Laravel App,或者您的IP经常变化。

安装

composer require thinkingcircles/flaredns-client

// config/app.php

'providers' => [
    // Other service providers...    
    ThinkingCircles\FlareDNSClient\FlareDNSClientServiceProvider::class,
]
php artisan vendor:publish --provider="ThinkingCircles\FlareDNSClient\FlareDNSClientServiceProvider"

获取CloudFlare API密钥

配置

// .env

cloudflare_zone_id=
cloudflare_global_api_key=
cloudflare_api_email=

:或

// config/flaredns-client.php

<?php return [
    
    'cloudflare_api_account' => [
        'cloudflare_zone_id' => 'ZONE-ID',
        'cloudflare_global_api_key' => 'API-KEY',
        'cloudflare_api_email' => 'API-EMAIL',
        'dns_records' => [
        	//will match id or name
            ['id'=>null, 'name'=>'domain.net'],
            ['id'=>'CloudFlare-API-Record-ID', 'name'=>null]
        ]
    ]

];

定时任务设置 - Laravel 5.4 - 定时任务

// Cron if you have not setup already

* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1

用法

// App/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    $schedule->command('flarednsclient:ipsync')->everyFiveMinutes();
}

待办事项