using base64 encoded json string instead of raw json for secrets

This commit is contained in:
Kingkor Roy Tirtho 2022-03-18 16:12:49 +06:00
parent 3c34b32356
commit 46bb8e202d
2 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,7 @@ jobs:
cache: true
- run: flutter config --enable-windows-desktop
- run: flutter pub get
- run: dart bin/create-secrets.dart "${{ secrets.SECRET }}"
- run: dart bin/create-secrets.dart '${{ secrets.SECRET }}'
- run: flutter build windows
- run: choco install make -y
- run: make innoinstall

View File

@ -8,7 +8,8 @@ void main(List<String> args) async {
throw ArgumentError("Expected an argument but none was passed");
}
final val = jsonDecode(args.first);
var decodedSecret = utf8.decode(base64Decode(args.first));
final val = jsonDecode(decodedSecret);
if (val is! List) {
throw Exception(
"'SECRET' Environmental Variable isn't configured properly");
@ -16,5 +17,5 @@ void main(List<String> args) async {
await File(path.join(
Directory.current.path, "lib/models/generated_secrets.dart"))
.writeAsString("final List<String> secrets = ${args.first};");
.writeAsString("final List<String> secrets = $decodedSecret;");
}