Skip to content

Provide an effective configuration file #610

@bwangelme

Description

@bwangelme

Hello, I'm trying to run the thrift server example in this repo. thriftbp/example_server_test.go

But got some errors related to configuration files, please help me.

1. No config file panic

I run the server by go run server.go, i get a panic error

panic: no $BASEPLATE_CONFIG_PATH specified, cannot load config

goroutine 1 [running]:

which indicating that no $BASEPLATE_CONFIG_PATH environment variable is specified, which means the server cannot load the necessary configuration file. To fix this error, I specify the path to the configuration file by setting the BASEPLATE_CONFIG_PATH environment variable to the path of the configuration file, like this:

BASEPLATE_CONFIG_PATH='example/server_cfg.yaml' go run server.go

example/server_cfg.yaml is copy from unittest baseplate_test.go, and I delete the redis config.

2. secrets.json not exist panic

Then, I run the server with BASEPLATE_CONFIG_PATH='example/server_cfg.yaml' go run server.go

The server starts normally, But a few seconds laster, the server panic, and I got following error

ø> BASEPLATE_CONFIG_PATH='example/server_cfg.yaml' go run server.go
2023-03-24T17:23:06.864+0800    DEBUG   Parsed configuration as *baseplate.Config:
addr: :8080
timeout: 30s
stopTimeout: 30s
log:
 level: info
runtime:
 numProcesses:
  max: 100
secrets:
 path: /tmp/secrets.json
tracing:
 namespace: baseplate-test
 queueName: test
 recordTimeout: 1ms
 sampleRate: 0.01
        {"pre_init": true}
maxprocs: Leaving GOMAXPROCS=12: CPU quota undefined
panic: baseplate.New: failed to init secrets: filewatcher: context canceled while waiting for file(s) under "/tmp/secrets.json" to load: errorsbp.Batch: total 2 error(s) in this batch: context deadline exceeded; last error: filewatcher: i/o error: stat /tmp/secrets.json: no such file or directory (config: secrets.Config{Path:"/tmp/secrets.json"})

which means I need to provide a valid secrets.json config file. What's the format of secrets.json, can you give me an exmaple, and explain it's meaning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions