You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use YdbPlatform\Ydb\Auth\Implement\MetadataAuthentication;
303
303
304
304
$config = [
305
305
@@ -355,7 +355,7 @@ or:
355
355
<?php
356
356
357
357
use YdbPlatform\Ydb\Ydb;
358
-
use YdbPlatform\Ydb\Auth\AnonymousAuthentication;
358
+
use YdbPlatform\Ydb\Auth\Implement\AnonymousAuthentication;
359
359
360
360
$config = [
361
361
@@ -379,6 +379,44 @@ $config = [
379
379
$ydb = new Ydb($config);
380
380
```
381
381
382
+
## Determined by environment variables
383
+
384
+
```php
385
+
<?php
386
+
387
+
use YdbPlatform\Ydb\Ydb;
388
+
use YdbPlatform\Ydb\Auth\Implement\EnvironCredentials;
389
+
390
+
$config = [
391
+
392
+
// Database path
393
+
'database' => '/local',
394
+
395
+
// Database endpoint
396
+
'endpoint' => 'localhost:2136',
397
+
398
+
// Auto discovery (dedicated server only)
399
+
'discovery' => false,
400
+
401
+
// IAM config
402
+
'iam_config' => [
403
+
'insecure' => true,
404
+
],
405
+
406
+
'credentials' => new EnvironCredentials()
407
+
];
408
+
409
+
$ydb = new Ydb($config);
410
+
```
411
+
412
+
The following algorithm that is the same for YDB-PHP-SDK applies:
413
+
414
+
1. If the value of the `YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS` environment variable is set, the **System Account Key** authentication mode is used and the key is taken from the file whose name is specified in this variable.
415
+
2. Otherwise, if the value of the `YDB_ANONYMOUS_CREDENTIALS` environment variable is set to 1, the anonymous authentication mode is used.
416
+
3. Otherwise, if the value of the `YDB_METADATA_CREDENTIALS` environment variable is set to 1, the **Metadata** authentication mode is used.
417
+
4. Otherwise, if the value of the `YDB_ACCESS_TOKEN_CREDENTIALS` environment variable is set, the **Access token** authentication mode is used, where the this variable value is passed.
418
+
5. Otherwise, the **Metadata** authentication mode is used.
419
+
382
420
# Usage
383
421
384
422
You should initialize a session from the Table service to start querying.
0 commit comments