Skip to content

Commit

Permalink
Move .env files to assets folder
Browse files Browse the repository at this point in the history
  • Loading branch information
heejongahn committed Aug 7, 2020
1 parent b91e687 commit a6e2d65
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/not_logged_in_app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:developer';

import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:flutter/material.dart';

Expand Down
4 changes: 3 additions & 1 deletion lib/utils/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Future<void> loadEnvForCurrentFlavor() async {
final flavor = await getCurrentFlavor();
final envFileName = _getEnvFileName(flavor);

await _dotEnv.load(envFileName);
await _dotEnv.load('assets/$envFileName');

if (!_dotEnv.isEveryDefined(_vars)) {
throw '$envFileName: Not all environment variables were provided.';
Expand All @@ -53,4 +53,6 @@ Future<void> loadEnvForCurrentFlavor() async {
env.apiEndpoint = _dotEnv.env[_KEY_apiEndpoint];
env.webEndpoint = _dotEnv.env[_KEY_webEndpoint];
env.sentryDSN = _dotEnv.env[_KEY_sentryDSN];

print(env.apiEndpoint);
}
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ flutter:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- .env.dev
- .env.prod
- assets/.env.dev
- assets/.env.prod
- assets/icon/icon.png

fonts:
- family: Spoqa-Han-Sans
Expand Down
8 changes: 4 additions & 4 deletions scripts/archive_secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const { execSync } = require("child_process");
const flavors = ["dev", "prod"];

const firebaseSecretFiles = flavors
.map(flavor => [
.map((flavor) => [
`android/app/src/${flavor}/google-services.json`,
`ios/config/${flavor}/GoogleService-Info.plist`
`ios/config/${flavor}/GoogleService-Info.plist`,
])
.reduce((accm, curr) => accm.concat(curr), []);

Expand All @@ -19,14 +19,14 @@ const secretFiles = [
...firebaseSecretFiles,

// Environment:
...flavors.map(flavor => `.env.${flavor}`)
...flavors.map((flavor) => `assets/.env.${flavor}`),
];

async function archiveSecrets() {
console.log(
[
"💾 Archiving files:",
...secretFiles.map(filename => `📄 ${filename}`)
...secretFiles.map((filename) => `📄 ${filename}`),
].join("\n")
);

Expand Down
Binary file modified secrets.tar.enc
Binary file not shown.

0 comments on commit a6e2d65

Please sign in to comment.