Skip to content

Commit 7570ce2

Browse files
author
Илья
committed
Update CHANGELOG.md and README.md
1 parent 5121630 commit 7570ce2

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* added ReadFromTextFileCredentials
12
* added lambda on exception in retryTransaction
23

34
## 1.10.0

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,36 @@ The following algorithm that is the same for YDB-PHP-SDK applies:
417417
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.
418418
5. Otherwise, the **Metadata** authentication mode is used.
419419

420+
## Reading from text file
421+
422+
```php
423+
<?php
424+
425+
use YdbPlatform\Ydb\Ydb;
426+
use YdbPlatform\Ydb\Auth\ReadFromTextFileCredentials;
427+
428+
$config = [
429+
430+
// Database path
431+
'database' => '/local',
432+
433+
// Database endpoint
434+
'endpoint' => 'localhost:2136',
435+
436+
// Auto discovery (dedicated server only)
437+
'discovery' => false,
438+
439+
// IAM config
440+
'iam_config' => [
441+
'insecure' => true,
442+
],
443+
444+
'credentials' => new ReadFromTextFileCredentials($tokenPath, $refreshTime)
445+
];
446+
447+
$ydb = new Ydb($config);
448+
```
449+
420450
# Usage
421451

422452
You should initialize a session from the Table service to start querying with retry.

src/Auth/ReadFromTextCredentials.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace YdbPlatform\Ydb\Auth;
44

5-
class ReadFromTextCredentials extends Auth
5+
class ReadFromTextFileCredentials extends Auth
66
{
77

88
protected $fileName;

tests/CheckReadTokenFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testReadTokenFile(){
1919
// Auto discovery (dedicated server only)
2020
'discovery' => false,
2121

22-
'credentials' => new ReadFromTextCredentials("./tests/token.txt")
22+
'credentials' => new ReadFromTextFileCredentials("./tests/token.txt")
2323
];
2424

2525
$ydb = new Ydb($config);

0 commit comments

Comments
 (0)