Skip to content

Commit

Permalink
feat(database): allow environment variables to override config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweichi committed Sep 9, 2024
1 parent bce3383 commit c3aa253
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions database/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"os"
"path/filepath"

"scroll-tech/common/utils"
)

// DBConfig db config
Expand All @@ -29,5 +31,11 @@ func NewConfig(file string) (*DBConfig, error) {
return nil, err
}

// Override config with environment variables
err = utils.OverrideConfigWithEnv(cfg, "SCROLL_ROLLUP_DB_CONFIG")
if err != nil {
return nil, err
}

return cfg, nil
}

0 comments on commit c3aa253

Please sign in to comment.