Closed aogier closed 5 months ago
I am not sure how formatting system relates to this. Do you mean that you would like to write something like token = "$(cat my_file)"
? This sounds like shell expansion, which some blocks already support, but the problem is that shellexpand
crate that we use for this does not support this type of expansion. Maybe this can be supported somehow (using different crate or improving this one).
By the way, you can use I3RS_GITHUB_TOKEN
env variable to pass the token. Since you may want to version your shell config too, you can create a non-versioned script which just wraps i3status-rs
and starts it with this environment variable.
Adding token_file
is fine too, if you think it would be more convenient.
I was not sure either about the formatting system but you've got what I was meaning, thanks :)
Env variable is an interesting option and I just didn't see it in block description 😭 sorry for the noise and thank you for your response, ciao!
No problem!
Dear maintainers, I've switched to i3status-rust from a python-based one and so far I'm so happy, thanks for the great project!
Now I'd like to version the configuration file in my dotfiles repo, but I cannot because the token in the github block. As far as I can tell, there is no way to source this value from outside conf file. Since I happen to be learning rust, I might be interested in contributing the functionality assuming there is interest in having it :)
The simple way: modify github block
The first solution that comes to mind is to change the behavior of the individual block to specify an external file with the secret to read. That is, an eg.
token_file
option to be mutually exclusive w/ thetoken
parameter.The flexible way: include subcommands' output
Another, more flexible and generic way for doing that would be extending formatters system in order to somehow allow to bring foreign text from eg. a shell script, to be invoked when evaluating configuration (or maybe at each interval if in
format
). I'm not sure how to do unobtrusively do that w/ current formatters system.What do you think? Thank you, regards!