Allow empty value for PIA region

This commit is contained in:
Quentin McGaw (desktop)
2020-02-16 20:29:37 +00:00
parent 95ee3b4276
commit 71dcf23013

View File

@@ -42,7 +42,7 @@ func (p *paramsReader) GetPIAEncryption() (models.PIAEncryption, error) {
// GetPIARegion obtains the region for the PIA server from the // GetPIARegion obtains the region for the PIA server from the
// environment variable REGION // environment variable REGION
func (p *paramsReader) GetPIARegion() (region models.PIARegion, err error) { func (p *paramsReader) GetPIARegion() (region models.PIARegion, err error) {
choices := constants.PIAGeoChoices() choices := append(constants.PIAGeoChoices(), "")
s, err := p.envParams.GetValueIfInside("REGION", choices) s, err := p.envParams.GetValueIfInside("REGION", choices)
if len(s) == 0 { // Suggestion by @rorph https://github.com/rorph if len(s) == 0 { // Suggestion by @rorph https://github.com/rorph
s = choices[rand.Int()%len(choices)] s = choices[rand.Int()%len(choices)]