Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to dev-1172-dereferencing

� Conflicts:
�	main.go
  • Loading branch information
Toktar committed Apr 20, 2022
2 parents 546f751 + f54ec2f commit 5d9d47a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
24 changes: 11 additions & 13 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@

FROM golang:1.17.8-buster as builder

# Set user directory and details
ENV CHEQD_RESOLVER_HOME_DIR="/home/cheqd-resolver"
ARG UID=1000
ARG GID=1000

# Add cheqd user to use in the container
RUN groupadd --system --gid $GID cheqd-resolver \
&& useradd --system --create-home --home-dir ${CHEQD_RESOLVER_HOME_DIR} --shell /bin/bash --gid cheqd-resolver --uid $UID cheqd-resolver

WORKDIR ${CHEQD_RESOLVER_HOME_DIR}
USER cheqd-resolver
WORKDIR /root

COPY types ./types
COPY services ./services
Expand All @@ -34,11 +24,19 @@ LABEL org.opencontainers.image.description "Cheqd DID-Resolver runner"
LABEL org.opencontainers.image.source "https://github.com/cheqd/cheqd-did-resolver"
ENV CHEQD_RESOLVER_HOME_DIR="/home/cheqd-resolver"

# Set user directory and details
ARG UID=1000
ARG GID=1000
# Add cheqd user to use in the container
RUN groupadd --system --gid $GID cheqd-resolver \
&& useradd --system --create-home --home-dir ${CHEQD_RESOLVER_HOME_DIR} --shell /bin/bash --gid cheqd-resolver --uid $UID cheqd-resolver

# Copy compiled cheqd-did-resolver binary from Stage 1
COPY --from=builder ${CHEQD_RESOLVER_HOME_DIR} /bin
COPY --from=builder /root /bin

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

USER cheqd-resolver
EXPOSE 1313
ENTRYPOINT ["cheqd-did-resolver"]
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: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ import (

func main() {
viper.SetConfigFile("config.yaml")
viper.SetConfigType("env")
viper.AutomaticEnv()
err1 := viper.ReadInConfig()

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

viper.AutomaticEnv()

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

Expand All @@ -32,11 +35,8 @@ func main() {
e.Use(middleware.Logger())
e.Use(middleware.Recover())

fmt.Println(didResolutionPath)

//setup
networks := viper.GetStringMapString("networks")
fmt.Println(networks)
ledgerService := services.NewLedgerService()
for network, url := range networks {
e.StdLogger.Println(network)
Expand Down

0 comments on commit 5d9d47a

Please sign in to comment.