Ankit Kumar
Ankit Kumar

Reputation: 131

missing .env file in gitlab CI

So I have a react native app in my repo that I'm working on and in my repo I have a .env file that I'm ignoring so that my secrets don't get exposed and a .env-example file of important environment variables to configure. My problem is, since I'm not pushing the .env file to my repo, when I deploy my app through the google app engine(this is done in the deployment stage in my gitlab-ci.yml file), these environment variables will not be present in production and I need them for my app to work as I do something like this in my build.gradle file.

   defaultConfig {
    applicationId "com.beecash.app"
    minSdkVersion rootProject.ext.minSdkVersion
    multiDexEnabled true // enabled for adding play service dependency
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 19
    versionName "0.10.1"
    manifestPlaceholders = [
        BRANCH_LIVE_KEY: project.env.get('BRANCH_LIVE_KEY'),
        BRANCH_TEST_KEY: project.env.get('BRANCH_TEST_KEY'),
        BRANCH_TEST_MODE: project.env.get('BRANCH_TEST_MODE'),
        CLEVERTAP_ACCOUNT_ID: project.env.get('CLEVERTAP_ACCOUNT_ID'),
        CLEVERTAP_TOKEN: project.env.get('CLEVERTAP_TOKEN')
    ]
}

Upvotes: 3

Views: 4935

Answers (1)

Amir Dadkhah
Amir Dadkhah

Reputation: 1154

As an alternative to .env file, you can set variables in CI/CD settings through the repository menu:

Repository menu > Settings > CI/CD > Variables

And easily access them inside CI/CD pipelines and jobs.
For more info you can check official docs.

Upvotes: 2

Related Questions