i-love-flamingo / flamingo

Flamingo Framework and Core Library. Flamingo is a go based framework to build pluggable applications. Focus is on clean architecture, maintainability and operation readiness.

Home Page:http://www.flamingo.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem in bootstrapping graphql module

asif-ir opened this issue · comments

This is the error that is thrown when I try to run go generate . as mentioned in the graphql module readme.

2020/06/16 21:19:46 app: config load: root: flamingo.me/flamingo/v3/core/oauth.Module:4:10: cue: marshal error at path core.oauth.secret: cannot convert incomplete value "string" to JSON
exit status 1
main.go:4: running "go": exit status 1

Any idea?

Thanks
Can you share the content of your main.go and go.mod file to check details?

Try adding a file config/config.yml

with content:
core.oauth.secret: foo

Thanks for the reply.

The config.yml suggestion didn't work.

Here are the requested files, nothing much to see here:

go.mod

module helloworld

go 1.14

require (
	flamingo.me/dingo v0.2.9
	flamingo.me/flamingo-commerce/v3 v3.2.0
	flamingo.me/flamingo/v3 v3.2.0
)

main.go

package main

//go:generate rm -f graphql/generated.go
//go:generate go run -tags graphql main.go graphql

import (
	"flamingo.me/dingo"
	"flamingo.me/flamingo-commerce/v3/cart"
	"flamingo.me/flamingo-commerce/v3/category"
	"flamingo.me/flamingo-commerce/v3/checkout"
	"flamingo.me/flamingo-commerce/v3/customer"
	"flamingo.me/flamingo-commerce/v3/order"
	"flamingo.me/flamingo-commerce/v3/payment"
	"flamingo.me/flamingo-commerce/v3/price"
	"flamingo.me/flamingo-commerce/v3/product"
	"flamingo.me/flamingo-commerce/v3/search"
	"flamingo.me/flamingo/v3"

	"helloworld/helloworld"
)

func main() {
	flamingo.App([]dingo.Module{
		new(helloworld.Module),
		new(product.Module),
		new(price.Module),
		new(category.Module),
		new(cart.Module),
		new(payment.Module),
		new(search.Module),
		new(checkout.Module),
		new(customer.Module),
		new(order.Module),
	})
}

Am I missing something significant?

Hey

Thanks for the details.

The error that you see is basically the Flamingo Cue Config validation. It means a config "core.oauth.secret" is expected but not found.

The problem is not the graphql module but you are including many of the Flamingo-Commerce Modules. The cart module has the dependency to to flamingo/oauth module currently and this requires a valid configuration. We have provided an empty default in the last version of flamingo. So if you update flamingo it should work:

go get flamingo.me/flamingo/v3@c9b71d405d20bcb90eae8fb41092e61e6ba45ba5

However you will see other error messages when you try the Flamingo Commerce Modules without proper configuration. (e.g. missing product adapters)

We are currently working on a proper blogpost for the first steps with Flamingo Commerce - it is still WIP but I think it will help:
https://github.com/danielpoe/flamingo-myshop-example

Feedback welcome and let us know where we can help.

PS: Can you share for what use case you are looking into Flamingo Commerce?

This made it work. Certainly more detailed docs would be great.

I was just comparing some open source offerings for e-commerce.

Nice - whats your outcome and impression so far?