cli/js console: if corsDomain is not given to startRpc, we fall back to value set on command line with -corsDomain

This commit is contained in:
zelig
2015-04-22 14:55:01 +01:00
parent 1b7c017076
commit 6b1b5a4a2a
4 changed files with 14 additions and 11 deletions

View File

@ -59,17 +59,19 @@ func (r dumbterm) PasswordPrompt(p string) (string, error) {
func (r dumbterm) AppendHistory(string) {}
type jsre struct {
re *re.JSRE
ethereum *eth.Ethereum
xeth *xeth.XEth
ps1 string
atexit func()
re *re.JSRE
ethereum *eth.Ethereum
xeth *xeth.XEth
ps1 string
atexit func()
corsDomain string
prompter
}
func newJSRE(ethereum *eth.Ethereum, libPath string, interactive bool) *jsre {
func newJSRE(ethereum *eth.Ethereum, libPath string, interactive bool, corsDomain string) *jsre {
js := &jsre{ethereum: ethereum, ps1: "> "}
// set default cors domain used by startRpc from CLI flag
js.corsDomain = corsDomain
js.xeth = xeth.New(ethereum, js)
js.re = re.New(libPath)
js.apiBindings()