grammers icon indicating copy to clipboard operation
grammers copied to clipboard

tests are failing due to examples env variable requirement

Open ehsan2003 opened this issue 2 years ago • 1 comments

tests are failing due to missing environment variables in examples it might be better to have them as runtime dependencies instead of compile time.

additionally having those critical information in a compiled code might be a security problem.

ehsan2003 avatar Apr 14 '22 02:04 ehsan2003

If you're referring to TG_ID and TG_HASH, that is intentional. It's a good thing that the examples showcase it this way because, when shipping your finished application (imagine the official Telegram Desktop), these values must be present in the final binary (it's also the case for Telegram Desktop). There is no other option. The application cannot work without these values.

Because the application cannot work without these values, I think it's a good thing they're required at compile-time. If we can keep cargo run --example failing, but cargo test working, I would like that.

Lonami avatar Apr 14 '22 11:04 Lonami

I'm going to close this issue. CI sets the variables for testing:

https://github.com/Lonami/grammers/blob/c348bb23988ad0d9f4f9ee76c91038975a94d155/.github/workflows/rust.yml#L27-L32

And as explained I'd prefer if they remain compile time variables.

Lonami avatar Oct 15 '22 08:10 Lonami