TatsuUkraine / dart_environment_config

Environment specific config generator for Dart and Flutter applications during CI/CD builds
https://pub.dev/packages/environment_config
BSD 3-Clause "New" or "Revised" License
92 stars 8 forks source link

Can't use ampersand. #49

Open DeepSeaPlain opened 1 year ago

DeepSeaPlain commented 1 year ago

I am trying to copy a URL to a config file and the "&" character and everything behind it gets cut off. Example URL: https://example.com/data/?id=6969&token=1A2B3C4D5E6F7G8H9

"--usedUrl=https://example.com/data/?id=6969&token=1A2B3C4D5E6F7G8H9"

The result is: https://example.com/data/?id=6969 and he rest behind it is missing.

I have tried using \& \\& wrapping the entire URL in \"https://example.com/data/?id=6969&token=1A2B3C4D5E6F7G8H9\" and many combinations of it.

TatsuUkraine commented 1 year ago

Hello, thank you for report, I will take a look what is going on as soon as I get free)

TatsuUkraine commented 1 year ago

You generating dart class or .env file?

DeepSeaPlain commented 1 year ago

@TatsuUkraine I'm generating a dart class.

TatsuUkraine commented 1 year ago

@DeepSeaPlain what OS are you using? I tried to run command with your value in the example project and all works

DeepSeaPlain commented 1 year ago

My Platform is Windows. I'm using a yaml file to generate a dart class.

var arguments = [ 'pub', 'run', 'environment_config:generate', '--config=some_config.yaml', '--var1=${package.var1}', '--var2=${package.var2}', '--var3=${package.var3}', ];

Im using the command:

Process.runSync( 'flutter.bat', arguments, runInShell: false, );

It gets cut off when im running it with Proccess.runSync()

TatsuUkraine commented 1 year ago

Ok, I will try to create shell file. Could you try to run generate command straight from the terminal? I'm just thinking that it may not necessary related to the package, but simply because something happens with the value when you passing it in *.bat file.

TatsuUkraine commented 1 year ago

Maybe you need to encode URI string before you passing it in bat file? It's just an assumption, since I don't have windows to check if it works(

TatsuUkraine commented 1 year ago

Another option probably (if you didn't try it yet), wrap value with quotes

var arguments = [
'pub',
'run',
'environment_config:generate',
'--config=some_config.yaml',
'--var1="${package.var1}"',
'--var2="${package.var2}"',
'--var3="${package.var3}"',
];