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

ENH Ensure TX_TOKEN environment variable is present #38

Closed
wants to merge 1 commit into from

Conversation

emteknetnz
Copy link
Member

Issue silverstripe/.github#365

TX_TOKEN is used by the tx binary which is called as a shell process. If it's not present then the program will fail.

@GuySartorelli
Copy link
Member

Is this a new requirement? Is there a tx changelog somewhere that shows this being a new requirement? Or was this always required but we're just now adding a check for it?

Comment on lines +105 to +113
$txToken = getenv('TX_TOKEN');
if (!$txToken) {
$message = implode(' ', [
'Could not get a valid token from TX_TOKEN environment variable.',
'Generate this at https://app.transifex.com/user/settings/api/ and add it to `~/.transifexrc` file by' .
' manually running `tx push -s` on a supported repository and entering your token when prompted.'
]);
throw new RuntimeException($message);
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks like we're checking if an environment variable is present..... but not using it? Is this actually meant to check that ~/.transifexrc is set correctly? If so, check that instead.

Copy link
Member Author

@emteknetnz emteknetnz Feb 12, 2025

Choose a reason for hiding this comment

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

Seems like you actually need to pass it in. If you manually run tx push -s then ~/.transifexrc will be read, however in a PHP context there's the ~ directory presumably doesn't work. The tx binary (not our PHP program) will read TX_TOKEN so that it doesn't need to read from ~/.transifexrc

I'm not sure why this is now required. Possibly something's changed via an update in the tx binary since the last time this program was run? Though I don't see anything in their changelog or here

@emteknetnz
Copy link
Member Author

Closed in favour of #39

@emteknetnz emteknetnz closed this Feb 12, 2025
@GuySartorelli GuySartorelli deleted the pulls/1/readme branch February 12, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants