ibrahim-mubarak / define-env Goto Github PK
View Code? Open in Web Editor NEWConvert .env file to a dart-define string
License: BSD 3-Clause "New" or "Revised" License
Convert .env file to a dart-define string
License: BSD 3-Clause "New" or "Revised" License
On CI (docker unix image but I'm able to reproduce on windows Powershell), I'm using this tool like that:
flutter build web $(flutter pub run define_env -f "env/.staging.env")
Everything is working fine if .staging.env file doesn't contains space but it's failing each time there is one (KEY="VALUE WITH SPACE" for example)
It's exactly the same than that issue: flutter/flutter-intellij#4588. After some investigation, I think I understand why, but can't figure out how to fix it. The output of the command in interpreted as a string, and the flutter build/run command is not working fine in these cases.
Relevant working samples:
flutter build web --dart-define=KEY1=VALUE1 --dart-define=KEY2="VALUE2 WITH SPACE"
flutter build web '--dart-define=KEY2="VALUE2 WITH SPACE"'
flutter build web '--dart-define=KEY1=VALUE1' '--dart-define=KEY2="VALUE2 WITH SPACE"'
Relevant NOT working samples:
flutter build web '--dart-define=KEY1=VALUE1 --dart-define=KEY2="VALUE2 WITH SPACE"'
=> output "Target file "WITH" not found."
The thing is I'm not sure I can raise an issue to flutter team as the command line argument is not designed to be inserted between quotes. I think the real issue is on the way "define_env" is outputing the result.
<configuration name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" />
</configuration>
define-env
doesn't auto add additionalArgs
if this key missing.
Using define_env -a configname
replaces existing args improperly
--release
and --vmservice-out-file
becomes
--relea e
and --vm ervice-out-file
This is probably due to improper substitution
This is useful when the env files are generated from another tool such as doppler and has to be piped directly to define_env
This can be extremely useful when using this CI/CD Tools
Right now, if a variable is present in System ENV, that variable is completely removed from the dart define string.
However, the variable should be present in dart define string if it's mentioned in the env file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.