-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ENV VAR names, Refactor server.go
- Loading branch information
Showing
6 changed files
with
126 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* Copyright (c) 2018, 2019 National Digital ID COMPANY LIMITED | ||
* | ||
* This file is part of NDID software. | ||
* | ||
* NDID is the free software: you can redistribute it and/or modify it under | ||
* the terms of the Affero GNU General Public License as published by the | ||
* Free Software Foundation, either version 3 of the License, or any later | ||
* version. | ||
* | ||
* NDID is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the Affero GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the Affero GNU General Public License | ||
* along with the NDID source code. If not, see https://www.gnu.org/licenses/agpl.txt. | ||
* | ||
* Please contact [email protected] for any further questions | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
// "os" | ||
// "strconv" | ||
// "time" | ||
|
||
"github.com/spf13/cobra" | ||
// "github.com/spf13/viper" | ||
|
||
// "github.com/tendermint/tendermint/cmd/tendermint/commands" | ||
// cfg "github.com/tendermint/tendermint/config" | ||
// tmflags "github.com/tendermint/tendermint/libs/cli/flags" | ||
// "github.com/tendermint/tendermint/libs/log" | ||
// "github.com/tendermint/tmlibs/cli" | ||
|
||
"github.com/ndidplatform/smart-contract/abci/version" | ||
) | ||
|
||
var abciVersionCmd = &cobra.Command{ | ||
Use: "abci_app_version", | ||
Short: "Show DID ABCI app version info", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println(version.Version) | ||
}, | ||
} | ||
|
||
// func customTMRootCmdPersistentPreRunE(cmd *cobra.Command, args []string) (err error) { | ||
// if cmd.Name() == commands.VersionCmd.Name() { | ||
// return nil | ||
// } | ||
// config, err := commands.ParseConfig() | ||
// if err != nil { | ||
// return err | ||
// } | ||
|
||
// var logTarget = getEnv("TENDERMINT_LOG_TARGET", logTargetConsole) | ||
// var logger log.Logger | ||
|
||
// if logTarget == logTargetConsole { | ||
// if config.LogFormat == cfg.LogFormatJSON { | ||
// logger = log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)) | ||
// } else { | ||
// logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) | ||
// } | ||
// } else if logTarget == logTargetFile { | ||
// currentTime := time.Now() | ||
// currentTimeStr := currentTime.Format(fileDatetimeFormat) | ||
|
||
// var logFilePath = getEnv("TENDERMINT_LOG_FILE_PATH", "./tm-"+strconv.Itoa(os.Getpid())+"-"+currentTimeStr+".log") | ||
// logFile, _ := os.OpenFile(logFilePath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666) | ||
|
||
// if config.LogFormat == cfg.LogFormatJSON { | ||
// logger = log.NewTMJSONLogger(log.NewSyncWriter(logFile)) | ||
// } else { | ||
// logger = log.NewTMLogger(log.NewSyncWriter(logFile)) | ||
// } | ||
// } else { | ||
// panic(fmt.Errorf("Unknown log target: \"%s\". Only \"console\" and \"file\" are allowed", logTarget)) | ||
// } | ||
|
||
// logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, cfg.DefaultLogLevel()) | ||
// if err != nil { | ||
// return err | ||
// } | ||
// if viper.GetBool(cli.TraceFlag) { | ||
// logger = log.NewTracingLogger(logger) | ||
// } | ||
// logger = logger.With("module", "main") | ||
// return nil | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ RUN go install \ | |
FROM alpine:3.8 | ||
LABEL maintainer="NDID IT Team <[email protected]>" | ||
ENV TERM=xterm-256color | ||
ENV DB_NAME=/DID | ||
ENV ABCI_DB_DIR_PATH=/DID | ||
|
||
# Tendermint will be looking for genesis file in /tendermint (unless you change | ||
# `genesis_file` in config.toml). You can put your config.toml and private | ||
|
@@ -74,11 +74,11 @@ COPY --from=builder /usr/local/lib /usr/local/lib | |
|
||
COPY --from=builder /go/bin/abci /usr/bin/did-tendermint | ||
COPY docker/start-node.sh /usr/bin/ | ||
RUN mkdir -p ${DB_NAME} ${TMHOME} | ||
RUN mkdir -p ${TMHOME} ${ABCI_DB_DIR_PATH} | ||
|
||
# Change owner to nobodoy:nogroup and permission to 640 | ||
RUN chown -R nobody:nogroup /usr/bin/start-node.sh /usr/bin/did-tendermint ${TMHOME} ${DB_NAME} | ||
RUN chmod -R 740 /usr/bin/start-node.sh /usr/bin/did-tendermint ${TMHOME} ${DB_NAME} | ||
RUN chown -R nobody:nogroup /usr/bin/start-node.sh /usr/bin/did-tendermint ${TMHOME} ${ABCI_DB_DIR_PATH} | ||
RUN chmod -R 740 /usr/bin/start-node.sh /usr/bin/did-tendermint ${TMHOME} ${ABCI_DB_DIR_PATH} | ||
|
||
USER nobody | ||
ENTRYPOINT ["start-node.sh"] | ||
|