google / secrets-gradle-plugin

A Gradle plugin for providing your secrets to your Android project.
Apache License 2.0
1.13k stars 99 forks source link

Don't use local.properties file as the default properties file #60

Open arriolac opened 1 year ago

arriolac commented 1 year ago

local.properties is an internal AGP file and is not meant as a mechanism for storing application secrets. The plugin should instead be modified to read for a different file (e.g. secrets.properties)

jamesncl commented 1 year ago

Including local.properties by default also causes a problem with Flutter projects, which by default include a property for the flutter SDK path in the template local.properties (for example flutter.sdk=C\:\\Users\\me\\mycode\\MyProject\\.fvm\\flutter_sdk), which in turn causes a build error illegal escape character when building the BuildConfig.java file when using this secrets gradle plugin.

So I tried to work around this by using debug.properties and release.properties files to include just the secrets I need to in BuildConfig.java, but it still also automatically includes local.properties. It would be nice if you could tell the plugin to ignore local.properties in the plugin configuration somehow, for example something like:

secrets {
   ignoreFiles.add("local.properties")
}

As a workaround I'm having to ignore keys like this, which feels wrong - every time I add another thing to local.properties I will have to remember to also exclude it from the secrets:

secrets {
    ignoreList.add("flutter*")
}