Skip to content

Commit

Permalink
Add: Configure EAS Secrets and environment variables in eas.json and …
Browse files Browse the repository at this point in the history
…app.config.ts
  • Loading branch information
ryosuketter committed Jul 6, 2023
1 parent 57afa41 commit 0df036d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
21 changes: 21 additions & 0 deletions app.config.ts
@@ -0,0 +1,21 @@
import { ExpoConfig, ConfigContext } from "@expo/config";
import { config } from "dotenv";

if (process.env.NODE_ENV !== "production") {
config(); // ".env" file is loaded only in non-production environments
}

export default ({ config: expoConfig }: ConfigContext): ExpoConfig => {
return {
...expoConfig,
name: "my-first-react-native-app",
slug: "my-first-react-native-app",
extra: {
microcmsApiKey: process.env.MICROCMS_API_KEY,
microcmsServiceDomain: process.env.MICROCMS_SERVICE_DOMAIN,
eas: {
projectId: "713c452f-8c8a-4875-ad08-1cbec7c13133",
},
},
};
};
13 changes: 12 additions & 1 deletion eas.json
Expand Up @@ -3,14 +3,25 @@
"version": ">= 3.14.0"
},
"build": {
"default": {
"env": {
"MICROCMS_API_KEY": "@secret:MICROCMS_API_KEY",
"MICROCMS_SERVICE_DOMAIN": "@secret:MICROCMS_SERVICE_DOMAIN"
}
},
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
"production": {
"env": {
"MICROCMS_API_KEY": "@secret:MICROCMS_API_KEY",
"MICROCMS_SERVICE_DOMAIN": "@secret:MICROCMS_SERVICE_DOMAIN"
}
}
},
"submit": {
"production": {}
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"axios": "^1.4.0",
"dotenv": "^16.3.1",
"expo": "~48.0.18",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
Expand Down

0 comments on commit 0df036d

Please sign in to comment.