fix areageoseeder to use env

This commit is contained in:
mahdahar 2026-02-19 13:27:08 +07:00
parent ece101b6d2
commit 5bfd71e7d7
2 changed files with 12 additions and 2 deletions

View File

@ -10,9 +10,15 @@ class AreaGeoSeeder extends Seeder
{ {
/** /**
* API configuration for fetching zones data * API configuration for fetching zones data
* Configure in .env: AREAGEO_API_URL=https://services-summit.my.id/api/zones
*/ */
protected string $apiUrl = 'https://services-summit.my.id/api/zones'; //DEV protected string $apiUrl;
//protected string $apiUrl = 'http://services-summit.my.id/api/zones'; //PROD
public function __construct()
{
parent::__construct();
$this->apiUrl = env('AREAGEO_API_URL', 'http://services-summit.my.id/api/zones');
}
// public function run() // public function run()
// { // {
@ -63,6 +69,7 @@ class AreaGeoSeeder extends Seeder
$client = Services::curlrequest([ $client = Services::curlrequest([
'baseURI' => $this->apiUrl, 'baseURI' => $this->apiUrl,
'timeout' => 30, 'timeout' => 30,
'verify' => str_starts_with($this->apiUrl, 'https://'),
]); ]);
$response = $client->get(''); $response = $client->get('');

3
env
View File

@ -67,3 +67,6 @@
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# logger.threshold = 4 # logger.threshold = 4
# Production (HTTP) - or just omit this line to use default
# AREAGEO_API_URL=http://services-summit.my.id/api/zones
# AREAGEO_API_URL=https://services-summit.my.id/api/zones