Skip to content

Commit

Permalink
DEV-1074: fix bag in configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Toktar committed Apr 20, 2022
1 parent 9ffa81c commit 24c31bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN groupadd --system --gid $GID cheqd-resolver \
# Copy compiled cheqd-did-resolver binary from Stage 1
COPY --from=builder /root /bin

# Copy base config.yml
# Copy base config.yaml
WORKDIR ${CHEQD_RESOLVER_HOME_DIR}

USER cheqd-resolver
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
context: ../
configs:
- source: config
target: ${CHEQD_RESOLVER_HOME_DIR}/config.yml
target: ${CHEQD_RESOLVER_HOME_DIR}/config.yaml
expose:
- ${RESOLVER_PORT}
ports:
Expand All @@ -29,4 +29,4 @@ services:

configs:
config:
file: ../config.yml
file: ../config.yaml
16 changes: 6 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ import (

func main() {
viper.SetConfigFile("config.yaml")
err := viper.ReadInConfig()
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %w \n", err))
}

err1 := viper.ReadInConfig()

viper.SetConfigFile(".env")
err = viper.ReadInConfig()
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %w \n", err))
err2 := viper.ReadInConfig()
if err1 != nil && err2 != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %w \n Fatal error config file: %w\n", err1, err2))
}

viper.AutomaticEnv()


didResolutionPath := viper.GetString("path")
didResolutionListener := viper.GetString("listener")

Expand Down

0 comments on commit 24c31bb

Please sign in to comment.