-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
// ignore_for_file: avoid_print | ||
part of '../env_reader.dart'; | ||
|
||
/// A function to take the .env file from given [path] into a more secured version inside [directory]. | ||
void insertAsset({required ArgResults argument}) { | ||
String path = argument['path']!.toString(); | ||
String password = argument['password']!.toString(); | ||
String data = File(path).readAsStringSync(); | ||
Directory directory = Directory('assets/env/')..createSync(recursive: true); | ||
String name = path.contains("/") ? path.split("/").last : path; | ||
File asset = File(directory.path + name)..writeAsStringSync(Encryptor.encrypt(password, data)); | ||
print("\x1B[32m$name\x1B[0m successfully secured into \x1B[34m${asset.path}\x1B[0m 🚀"); | ||
File asset = File(directory.path + name) | ||
..writeAsStringSync(Encryptor.encrypt(password, data)); | ||
print( | ||
"\x1B[32m$name\x1B[0m successfully secured into \x1B[34m${asset.path}\x1B[0m 🚀"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters