google / google/guice

Guice initialisation failes due to unresolvable variables in env variable values

Open
#1,230 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

Hi,

I have just been spending a large amount of time finding out why a piece of code that uses guice works in one environment (infrastructure) and not the other (my very own dev env). The problem, is that my PS1 env variable value contains variables like so:

PS1=${BLUE}\u${WHITE}@${GREEN}$(hostname -s)\[\033[0m\] \W$(git_prompt)\[\033[0m\] $\n

Now, guice seems to feel responsible to wire BLUE, WHITE and GREEN, which cannot be resolved in my dev env. This causes the initialisation to fail with:

5) An exception was caught and reported. Message: Property BLUE is not found as system property or environment variable.
at com.google.inject.util.Modules$OverrideModule.configure(Modules.java:195)

Yes this is a very clear statement, but I did not make the connection, that this BLUE is the BLUE referenced by my PS1, since that is absolutely not relevant for the piece of code that I tried to run. Is this a bug, or is this something that works as designed and should be expected?

Best Regards,

André

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.