File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
#
3
3
#
4
- RELEASE_VERSION=" 1.0.3 "
4
+ RELEASE_VERSION=" 1.0.4 "
5
5
6
6
buildpath=/tmp/gh-ost
7
7
target=gh-ost
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ package base
7
7
8
8
import (
9
9
"fmt"
10
+ "os"
11
+ "regexp"
10
12
"strings"
11
13
"sync"
12
14
"sync/atomic"
@@ -35,6 +37,10 @@ const (
35
37
CutOverTwoStep = iota
36
38
)
37
39
40
+ var (
41
+ envVariableRegexp = regexp .MustCompile ("[$][{](.*)[}]" )
42
+ )
43
+
38
44
// MigrationContext has the general, global state of migration. It is used by
39
45
// all components throughout the migration process.
40
46
type MigrationContext struct {
@@ -441,8 +447,19 @@ func (this *MigrationContext) ReadConfigFile() error {
441
447
if this .ConfigFile == "" {
442
448
return nil
443
449
}
450
+ gcfg .RelaxedParserMode = true
444
451
if err := gcfg .ReadFileInto (& this .config , this .ConfigFile ); err != nil {
445
452
return err
446
453
}
454
+
455
+ // We accept user & password in the form "${SOME_ENV_VARIABLE}" in which case we pull
456
+ // the given variable from os env
457
+ if submatch := envVariableRegexp .FindStringSubmatch (this .config .Client .User ); len (submatch ) > 1 {
458
+ this .config .Client .User = os .Getenv (submatch [1 ])
459
+ }
460
+ if submatch := envVariableRegexp .FindStringSubmatch (this .config .Client .Password ); len (submatch ) > 1 {
461
+ this .config .Client .Password = os .Getenv (submatch [1 ])
462
+ }
463
+
447
464
return nil
448
465
}
You can’t perform that action at this time.
0 commit comments