Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is inheritance as specifieed in the akka lightbend spec supported ? #4

Open
ymolists opened this issue Apr 6, 2018 · 3 comments
Open

Comments

@ymolists
Copy link

ymolists commented Apr 6, 2018

I was expecting test.g3.o1.order to return 1. Mind you the code does not raise an error now but it also does not return a correct value. As such i was not sure if this is supported or no ?

test.g1={
	o1 {
		order    = 1
	}
}

test.g2 = {
	o2 {
		order    = 2
	}
}

test.g3 = ${test.g1}
test.g3 = {
	o2 {
		order    = 2
	}
}

//or another more eaiser syntax way
test.g3 = ${test.g1} {
	o2 {
		order    = 2
	}
}

func TestInheritance(t *testing.T) {
	conf := LoadConfig("tests/t3.conf")
	fmt.Println("test.g3:", conf.GetInt64("test.g3.o1.order"))
}

Thanks !

@xujinzheng
Copy link
Contributor

package main

import (
	"fmt"
	"github.com/go-akka/configuration"
)

func main() {
	conf := configuration.ParseString(`
test.g1={
	o1 {
		order    = 1
	}
}

test.g2 = {
	o2 {
		order    = 2
	}
}

test.g3 = ${test.g1}

	`)

	fmt.Println(conf.GetInt64("test.g3.o1.order"))
}
$ go run main_hocon.go
1

you can use follow syntex:

test.g3 =  {
	o1 = ${test.g1.o1}
	o2 {
		order    = 2
	}
}
test.g3.o1 = ${test.g1.o1}
test.g3.o2 = ${test.g2.o2}

@ymolists
Copy link
Author

ymolists commented Apr 9, 2018

Would you be willing to accept a PR (if ever) because this seems a cool feature defined in the spec ?

Thank you so much for the quick reply !

@xujinzheng
Copy link
Contributor

Of course, it will make this project more better, thank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants