Coder Social home page Coder Social logo

Comments (7)

tr3v3r avatar tr3v3r commented on May 28, 2024 1

Yeap good idea thanks. I even didn't know that your lib provides such a possibility!

Actually, if we talk about CI, getting value from the environment is preferable, since it provides this variable automatically from the Secrets store ( Bitrise ).

But locally (during development) I didn't want to do the same way )

Thanks for your time! I suppose the question is resolved

from react-native-ultimate-config.

maxkomarychev avatar maxkomarychev commented on May 28, 2024

hi @tr3v3r the last time I checked this was possible using the following API: https://github.com/maxkomarychev/react-native-ultimate-config/blob/master/docs/api.md#buildgradle

it's quite hard to debug your issue not seeing any code - can you please create project with minimal reproducible example of the problem?

from react-native-ultimate-config.

maxkomarychev avatar maxkomarychev commented on May 28, 2024

@tr3v3r I am assuming things but you might be seeing this problem because you're not applying gradle plugin as described in quickstart guide:

apply from: "../../node_modules/react-native-ultimate-config/android/rnuc.gradle"

from react-native-ultimate-config.

tr3v3r avatar tr3v3r commented on May 28, 2024

@maxkomarychev I’ve got error not in android/app/build.gradle ( when according to docs I need to insert ‘apply from’ statement ) but in android/build.gradle. I suppose the config could not be reached from this place with current implementation. What do you think?

from react-native-ultimate-config.

maxkomarychev avatar maxkomarychev commented on May 28, 2024

oh I see, sorry for missing that part.

unfortunately I haven't even tried to apply the plugin there and frankly I'm not that well versed in gradle nuances.

do you mind sharing why is this needed? can this be moved into internal app/build.gradle? buildscripts are typically free from application-specific logic.. (at least on projects I've worked on)...

from react-native-ultimate-config.

tr3v3r avatar tr3v3r commented on May 28, 2024

I needed this because of this tutorial from the react-native-mapbox library.
In particular I need paste this code in android/build.gradle:

 maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                // Do not change the username below.
                // This should always be `mapbox` (not your username). 
                username = 'mapbox'
                // Use the secret token you stored in gradle.properties as the password
                password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
            }
        }

But also it's mandatory for us NOT to store this token directly in the project directory - so we decided to link it during build on CI. Obviously, the first thing that came to my mind is storing MAPBOX_DOWNLOADS_TOKEN in .env file (which is already linking on CI during the build ).

But it doesn't work:

 password = project.config.get['MAPBOX_DOWNLOADS_TOKEN'] ?: "" 

Actually, we came up with another solution:

password = System.getenv("MAPBOX_DOWNLOADS_TOKEN") as String

and just export this env variable on CI during the build. So we can close the issue if you want )

from react-native-ultimate-config.

maxkomarychev avatar maxkomarychev commented on May 28, 2024

Then I can suggest you to use hooks API and generate '.properties' file which gradle can naturally pick up

from react-native-ultimate-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.