Skip to content

Commit

Permalink
⚡️ env shim for easier config
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bierman committed May 1, 2024
1 parent fd7ab10 commit 133799d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 🛎️ For local dev
# 👉 Rename this file to .env.local
# 👉 Fill in the values below.

# MongoDB
MONGODB_URI="Your mongodb URI"

# Client
PUBLIC_CLIENT_URL="Your client url"
PUBLIC_NODE_ENV='development'
PUBLIC_API_URL='Your api url'
PUBLIC_APP="App identifier"

# API Keys
PUBLIC_NPS_API="Your api key"
PUBLIC_GEOAPIFY_KEY="Your api key"
PUBLIC_GOOGLE_PLACES_API_KEY='Your api key'
PUBLIC_MAPBOX_API_KEY="Your api key, starts with pk..."
PUBLIC_OPENWEATHER_KEY="Your api key"
PUBLIC_X_RAPIDAPI_KEY="Your api key"
PUBLIC_MAPBOX_ACCESS_TOKEN="Your api key, starts with pk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN="Your api key, starts with sk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN2="Your api key, starts with sk..."

# Google OAuth
PUBLIC_WEB_CLIENT_ID="Your Google OAuth web client ID"
PUBLIC_ANDROID_CLIENT_ID="Your Google OAuth Android client ID"
PUBLIC_IOS_CLIENT_ID="Your Google OAuth iOS client ID"
PUBLIC_GOOGLE_ID="Google client ID"

# Firebase
PUBLIC_FIREBASE_API_KEY='Your api key'
PUBLIC_FIREBASE_AUTH_DOMAIN="Your auth domain"
PUBLIC_FIREBASE_PROJECT_ID="Your firebase project id"
PUBLIC_FIREBASE_STORAGE_BUCKET="Your firebase_storage_key_link"
PUBLIC_FIREBASE_MESSAGING_SENDER_ID="Your firebase_messaging_sender_ID"
PUBLIC_FIREBASE_APP_ID="Your firebase app id"
PUBLIC_FIREBASE_MEASUREMENT_ID="Your firebase_measurement_id"
4 changes: 3 additions & 1 deletion .github/scripts/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ console.log('🔥 Generating .env.local files');

const autogeneratedComment =
'# This file is autogenerated. To make changes, modify the root level .env.local file and run bun install\n\n';
const outputName = '.env';
const outputName = '.env.local';

// Read the .env file
const envFilePath = path.join(__dirname, '..', '..', outputName);
Expand Down Expand Up @@ -87,3 +87,5 @@ const viteFileContent = envFileContent
})
.join('\n');
fs.writeFileSync(viteOutputPath, `${autogeneratedComment}\n${viteFileContent}`);

// TODO: Add wrangler env generation
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mongodb-data
*.env
.env.local
node_modules
# yarn.lock
# dist
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@rnmapbox/maps",
{
"RNMapboxMapsImpl": "mapbox",
"RNMapboxMapsDownloadToken": "pk.eyJ1IjoiYW5kcmV3Ymllcm1hbiIsImEiOiJjbDhwYTVtc3kwMGprM3Buejg3d2doa2pvIn0.F_D3I0KRlQkQK70DkK7MlQ"
"RNMapboxMapsDownloadToken": "MAPBOX_DOWNLOADS_TOKEN_FROM_ENV"
}
],
[
Expand Down
6 changes: 0 additions & 6 deletions apps/expo/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
},
"preview": {
"distribution": "internal",
"env": {
"EXPO_PUBLIC_GOOGLE_ID": "993694750638-876nvl8hfjfv6tqiqc1c4tmubvf8chpp.apps.googleusercontent.com",
"EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN": "pk.eyJ1IjoiYW5kcmV3Ymllcm1hbiIsImEiOiJjbDhwYTVtc3kwMGprM3Buejg3d2doa2pvIn0.F_D3I0KRlQkQK70DkK7MlQ",
"EXPO_PUBLIC_API_URL": "https://packrat_api.abbierman101.workers.dev/api",
"EXPO_PUBLIC_CLIENT_URL": "http://localhost:4200"
},
"ios": {
"resourceClass": "m-medium"
}
Expand Down

0 comments on commit 133799d

Please sign in to comment.