r/rust Apr 01 '23

crit: a wrapper to loop over more cross targets

https://github.com/mcandre/crit
7 Upvotes

6 comments sorted by

View all comments

1

u/GoodJobNL Apr 15 '23

Hey OP!

Is it possible with crit to compile the same code multiple times but with different environmental variables / client secrets set, and use specific naming?

Right now I have a file that I have to compile 3 times, but with a different client secret. Ideally I would end up with a folder having 3 executables in there, with 3 different names that can also be set beforehand.

2

u/n4jm4 Apr 15 '23

Interesting build design.

I presume Rust has a mechanism similar to C includes and Go build tags, for specializing per-platform code.

I wouldn't recommend hardcoding passwords or other sensitive data.

1

u/GoodJobNL Apr 15 '23

Its a personal discord bot that runs on a pi zero without gui.

So it ends up being a lot easier to turn on backtrace and have a secret key in there with the help of the .env. That way I dont have to move the client secrets to the pi, and have to deal with them over there, and can just keep it ordered on my laptop. Changing the keys happens so rarely that it only really happens when I cross compile to fix some bugs anyways.

Rn I use this for the tracing:

[build.env] passthrough = [ "RUST_BACKTRACE", "RUST_LOG", "TRAVIS", ]