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

Why does it seem like it doesn't support environment variables #163

Open
chinghoi opened this issue Jan 16, 2024 · 3 comments
Open

Why does it seem like it doesn't support environment variables #163

chinghoi opened this issue Jan 16, 2024 · 3 comments

Comments

@chinghoi
Copy link

I don't know what else needs to be configured

variables:
  PGYER_API_KEY: $PGYER_API_KEY

In terminal $PGYER_API_KEY is effective, like
image
but
image

@ddikman
Copy link

ddikman commented Jul 16, 2024

@chinghoi although it won't allow you to reference variables inside the variables array, looking at this code:
https://github.com/leanflutter/flutter_distributor/blob/main/packages/flutter_distributor/lib/src/flutter_distributor.dart#L325

It looks as though it will be pulling in the platform variables so if you just remove that one variable, it should work anyway.

However, I see in some places like here:
https://github.com/leanflutter/flutter_distributor/blob/main/packages/flutter_distributor/lib/src/flutter_distributor.dart#L156

That they might get included only as a fallback, so if just removing it doesn't work perhaps there is a bug.

@cybrox
Copy link
Contributor

cybrox commented Jul 16, 2024

It will definitely pull platform variables. I've been using this config for a long time now:

#distribute_options.yaml
env:
  # GOOGLE_APPLICATION_CREDENTIALS is exported by ./.keys/android/register.sh
  # APPSTORE_USERNAME and APPSTORE_PASSWORD is exported by ./.keys/ios/register.sh

releases:
...

# Makefile

ios_release:
	source .keys/ios/register.sh && \
	flutter_distributor release --name ios --jobs ios-production

...

# register.sh
export APPSTORE_USERNAME=...
export APPSTORE_PASSWORD=...

The reason for this somewhat roundabout setup is that .keys is a submodule with signing keys for multiple apps encrypted by git-secret. But this should work whichever way you set up the platform variables.

tl;dr: It will use your platform env variables. Only use env: to define additional ones.

@ddikman
Copy link

ddikman commented Jul 16, 2024

Yep, that's how I read it as well. Looking at the problem report the issue would be that $PGYER_API_KEY becomes the value. Just remove the line completely and it should work as @cybrox says.

variables:
  PGYER_API_KEY: $PGYER_API_KEY

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

No branches or pull requests

3 participants