Skip to content

Log an error when environment values begin with quotes #2084

@mlavi

Description

@mlavi

I am new to the project, so I started to run the container with an external environment file to externalize configuration. However, I did this before getting the simplest example running with environment defined directly during container run. I found that if I "quoted" the variables that it would cause the container to restart endlessly.

Describe the solution you'd like
It would helpful to detect any environment variable that start with a " or ' (outside of credentials, perhaps that is a legitimate character) and log an error.

Describe alternatives you've considered
Provide an external environment variables file example and add a comment about omitting quotes.

Additional context
My environment file:
ADMIN_PASSWORD="{{ gravity_admin_password }}"
BOOTSTRAP_ROLES="{{ gravity_bootstrap_roles }}"
LISTEN_ONLY=true
LOG_LEVEL="{{ gravity_log_level }}"

Logs of the error, I believe this was pertinent:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2cc1990]

goroutine 1 [running]:
beryju.io/gravity/pkg/instance.(*Instance).bootstrap(0x4000792800, {0x6152c70, 0x4000d22090})
        /workspace/pkg/instance/instance.go:183 +0x1a0
beryju.io/gravity/pkg/instance.(*Instance).Start(0x4000792800)
        /workspace/pkg/instance/instance.go:90 +0x140
beryju.io/gravity/cmd/server.init.func2(0x40002dd000?, {0x3a6fa0b?, 0x4?, 0x3a6fa0f?})
        /workspace/cmd/server/server.go:24 +0xb4
github.com/spf13/cobra.(*Command).execute(0x8b2c160, {0x9236980, 0x0, 0x0})
        /go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1019 +0x7bc
github.com/spf13/cobra.(*Command).ExecuteC(0x8b2be80)
        /go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1071
beryju.io/gravity/cmd/server.Execute()
        /workspace/cmd/server/root.go:22 +0x24
main.main()
        /workspace/cmd/server/main/main.go:8 +0x1c

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions