Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RR_VERSION env to Environment class #37

Merged
merged 6 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
/**
* @psalm-import-type ModeType from Mode
* @psalm-type EnvironmentVariables = array{
* RR_MODE?: ModeType|string,
* RR_RELAY?: string,
* RR_RPC?: string,
* RR_MODE?: ModeType|string,
* RR_RELAY?: string,
* RR_RPC?: string,
* RR_VERSION?: string,
* }|array<string, string>
* @see Mode
*/
Expand Down Expand Up @@ -40,6 +41,11 @@ public function getRPCAddress(): string
return $this->get('RR_RPC', 'tcp://127.0.0.1:6001');
}

public function getVersion(): string
{
return $this->get('RR_VERSION', '');
}

/**
* @template TDefault of string
*
Expand Down
5 changes: 5 additions & 0 deletions src/EnvironmentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public function getRelayAddress(): string;
* RPC address.
*/
public function getRPCAddress(): string;

/**
* Roadrunner version
*/
public function getVersion(): string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kaspiman Adding a new method to the interface can break the user implementation of this interface. I suggest not adding the method to the interface, but only to the implementation, and indicating it in the interface as a comment:

/**
 * Provides base values to configure roadrunner worker.
 *
 * @psalm-import-type ModeType from Mode
 * @see Mode
 * @method string getVersion()
 */

The method can then be added in the next major release of the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}