You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error, mongodb initialization failed: open /home/user/work/pkg/mod/github.com/zebresel-com/[email protected]+incompatible/locals.json: no such file or directory"
#30
Open
piyushgupte opened this issue
Nov 10, 2020
· 1 comment
I have built an executable of my go application which uses zebresel-com/mongodm and am trying to deploy it in docker container, but I am getting the following error.It is working great on my linux box but it fails when I try to deploy it inside docker.
" initialization failed: open /home/myuser/work/pkg/mod/github.com/zebresel-com/[email protected]+incompatible/locals.json: no such file or directory"
Steps to reproduce:
Create a go executable of work repo which is using zebresel-com/mongodm
Copy the executable in docker env via Docker copy command through Dockerfile
The text was updated successfully, but these errors were encountered:
Nearly one year later, I've got this problem too, digging it up I found out what it is
Once you generated the binary file, it still looks for this locals.json file to start the connection; The simple solution was to embed it as a string in my connection file, something like this:
var localMapStr = `
{
"en-US": {
"validation.field_required": "Field '%s' is required.",
"validation.field_invalid": "Field '%s' has an invalid value.",
"validation.field_invalid_id": "Field '%s' contains an invalid object id value.",
"validation.field_minlen": "Field '%s' must be at least %v characters long.",
"validation.field_maxlen": "Field '%s' can be maximum %v characters long.",
"validation.entry_exists": "%s already exists for value '%v'.",
"validation.field_not_exclusive": "Only one of both fields can be set: '%s'' or '%s'.",
"validation.field_required_exclusive": "Field '%s' or '%s' required."
}
}
`
var localMap map[string]map[string]string
json.Unmarshal([]byte(localMapStr), &localMap)
dbConfig := &mongodm.Config{
DatabaseHosts: []string{os.Getenv("MONGODB_HOST")},
DatabaseName: os.Getenv("MONGODB_DATABASE"),
Locals: localMap["en-US"],
}
Not really the best solution out there, but this package seems a little out of date anyway
I have built an executable of my go application which uses zebresel-com/mongodm and am trying to deploy it in docker container, but I am getting the following error.It is working great on my linux box but it fails when I try to deploy it inside docker.
" initialization failed: open /home/myuser/work/pkg/mod/github.com/zebresel-com/[email protected]+incompatible/locals.json: no such file or directory"
Steps to reproduce:
The text was updated successfully, but these errors were encountered: