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

Is it possible to use CredentialsManager::AppfileConfig for OTHER files besides Appfile? #1191

Open
slavdok opened this issue Feb 20, 2023 · 2 comments

Comments

@slavdok
Copy link

slavdok commented Feb 20, 2023

Fastlane is pushing to have all configuration in various *files, like Appfile, Matchfile, Deliverfile, etc.

However, only the values from Appfile can be retrieved using CredentialsManager::AppfileConfig.try_fetch_value().
This presents a problem as often we need to retrieve a value from configuration before running the action.

And without having ability to fetch values from other files, we are left with an inconsistency problem, where some configs are in Appfile, and others are scattered in ENV vars.

@rogerluan
Copy link
Member

I'm gonna be honest, I didn't even know you could load values from the Appfile like that :) but to your point, you could load ALL configs from env vars if you wanted (and use that as a single source of truth), and reference env vars in your Deliverfile, Appfile, Matchfile, etc... Would that work for you?

@slavdok
Copy link
Author

slavdok commented Feb 23, 2023

Thanks for the suggestion, but if I am maintaining the "source of truth" in ENV vars, then why have Appfile, etc in the first place?

This also introduces inconsistencies:

UI.message "Our package id is: #{CredentialsManager::AppfileConfig.try_fetch_value(:package_name)}"
UI.message "Saving metadata to: #{ENV['SUPPLY_METADATA_PATH']}"

I have to always check if the value I need can be got through CredentialManager or ENV
Another problem is that Appfiles take precedence over ENV vars
If I change the above to:

UI.message "Our package id is: #{ENV['SUPPLY_PACKAGE_NAME']}"
UI.message "Saving metadata to: #{ENV['SUPPLY_METADATA_PATH']}

and Appfile has a different value for package_name, I will be displaying the wrong information.
I hear what you are saying: use package_name ENV['SUPPLY_PACKAGE_NAME'] in Appfile.
But I cannot police what other developers would put into the Appfiles (we have many many projects), so if they put package_name "my app name" instead of ENV, then my code in Fastfile will be displaying the wrong value

With Appfile, Deliverfile, etc taking precedence over ENV vars, they (the files) become the source of truth.
In that case, I should be able to query them to get the truth (but alas right now that only works for Appfile) [that I know of]

I would gladly write:

UI.message "Our package id is: #{CredentialsManager::AppfileConfig.try_fetch_value(:package_name) || ENV['SUPPLY_PACKAGE_NAME']}"

but that only works for the few configs allowed in Appfile, and metadata_path is not in Appfile

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

2 participants