rename LOGRUS_* to LOG_*
This commit is contained in:
parent
5302122509
commit
190a714e53
12
cmd/root.go
12
cmd/root.go
@ -48,7 +48,7 @@ func Execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initFuncs(cmd *cobra.Command, args []string) {
|
func initFuncs(cmd *cobra.Command, args []string) {
|
||||||
logfile := viper.GetString(snapshot.LOGRUS_FILE_TOML)
|
logfile := viper.GetString(snapshot.LOG_FILE_TOML)
|
||||||
if logfile != "" {
|
if logfile != "" {
|
||||||
file, err := os.OpenFile(logfile,
|
file, err := os.OpenFile(logfile,
|
||||||
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
||||||
@ -83,7 +83,7 @@ func initFuncs(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func logLevel() error {
|
func logLevel() error {
|
||||||
lvl, err := log.ParseLevel(viper.GetString(snapshot.LOGRUS_LEVEL_TOML))
|
lvl, err := log.ParseLevel(viper.GetString(snapshot.LOG_LEVEL_TOML))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -102,13 +102,13 @@ func init() {
|
|||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file location")
|
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file location")
|
||||||
rootCmd.PersistentFlags().String(snapshot.LOGRUS_FILE_CLI, "", "file path for logging")
|
rootCmd.PersistentFlags().String(snapshot.LOG_FILE_CLI, "", "file path for logging")
|
||||||
rootCmd.PersistentFlags().String(snapshot.DATABASE_NAME_CLI, "vulcanize_public", "database name")
|
rootCmd.PersistentFlags().String(snapshot.DATABASE_NAME_CLI, "vulcanize_public", "database name")
|
||||||
rootCmd.PersistentFlags().Int(snapshot.DATABASE_PORT_CLI, 5432, "database port")
|
rootCmd.PersistentFlags().Int(snapshot.DATABASE_PORT_CLI, 5432, "database port")
|
||||||
rootCmd.PersistentFlags().String(snapshot.DATABASE_HOSTNAME_CLI, "localhost", "database hostname")
|
rootCmd.PersistentFlags().String(snapshot.DATABASE_HOSTNAME_CLI, "localhost", "database hostname")
|
||||||
rootCmd.PersistentFlags().String(snapshot.DATABASE_USER_CLI, "", "database user")
|
rootCmd.PersistentFlags().String(snapshot.DATABASE_USER_CLI, "", "database user")
|
||||||
rootCmd.PersistentFlags().String(snapshot.DATABASE_PASSWORD_CLI, "", "database password")
|
rootCmd.PersistentFlags().String(snapshot.DATABASE_PASSWORD_CLI, "", "database password")
|
||||||
rootCmd.PersistentFlags().String(snapshot.LOGRUS_LEVEL_CLI, log.InfoLevel.String(), "log level (trace, debug, info, warn, error, fatal, panic)")
|
rootCmd.PersistentFlags().String(snapshot.LOG_LEVEL_CLI, log.InfoLevel.String(), "log level (trace, debug, info, warn, error, fatal, panic)")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().Bool(snapshot.PROM_METRICS_CLI, false, "enable prometheus metrics")
|
rootCmd.PersistentFlags().Bool(snapshot.PROM_METRICS_CLI, false, "enable prometheus metrics")
|
||||||
rootCmd.PersistentFlags().Bool(snapshot.PROM_HTTP_CLI, false, "enable prometheus http service")
|
rootCmd.PersistentFlags().Bool(snapshot.PROM_HTTP_CLI, false, "enable prometheus http service")
|
||||||
@ -116,13 +116,13 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().String(snapshot.PROM_HTTP_PORT_CLI, "8086", "prometheus http port")
|
rootCmd.PersistentFlags().String(snapshot.PROM_HTTP_PORT_CLI, "8086", "prometheus http port")
|
||||||
rootCmd.PersistentFlags().Bool(snapshot.PROM_DB_STATS_CLI, false, "enables prometheus db stats")
|
rootCmd.PersistentFlags().Bool(snapshot.PROM_DB_STATS_CLI, false, "enables prometheus db stats")
|
||||||
|
|
||||||
viper.BindPFlag(snapshot.LOGRUS_FILE_TOML, rootCmd.PersistentFlags().Lookup(snapshot.LOGRUS_FILE_CLI))
|
viper.BindPFlag(snapshot.LOG_FILE_TOML, rootCmd.PersistentFlags().Lookup(snapshot.LOG_FILE_CLI))
|
||||||
viper.BindPFlag(snapshot.DATABASE_NAME_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_NAME_CLI))
|
viper.BindPFlag(snapshot.DATABASE_NAME_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_NAME_CLI))
|
||||||
viper.BindPFlag(snapshot.DATABASE_PORT_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_PORT_CLI))
|
viper.BindPFlag(snapshot.DATABASE_PORT_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_PORT_CLI))
|
||||||
viper.BindPFlag(snapshot.DATABASE_HOSTNAME_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_HOSTNAME_CLI))
|
viper.BindPFlag(snapshot.DATABASE_HOSTNAME_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_HOSTNAME_CLI))
|
||||||
viper.BindPFlag(snapshot.DATABASE_USER_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_USER_CLI))
|
viper.BindPFlag(snapshot.DATABASE_USER_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_USER_CLI))
|
||||||
viper.BindPFlag(snapshot.DATABASE_PASSWORD_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_PASSWORD_CLI))
|
viper.BindPFlag(snapshot.DATABASE_PASSWORD_TOML, rootCmd.PersistentFlags().Lookup(snapshot.DATABASE_PASSWORD_CLI))
|
||||||
viper.BindPFlag(snapshot.LOGRUS_LEVEL_TOML, rootCmd.PersistentFlags().Lookup(snapshot.LOGRUS_LEVEL_CLI))
|
viper.BindPFlag(snapshot.LOG_LEVEL_TOML, rootCmd.PersistentFlags().Lookup(snapshot.LOG_LEVEL_CLI))
|
||||||
|
|
||||||
viper.BindPFlag(snapshot.PROM_METRICS_TOML, rootCmd.PersistentFlags().Lookup(snapshot.PROM_METRICS_CLI))
|
viper.BindPFlag(snapshot.PROM_METRICS_TOML, rootCmd.PersistentFlags().Lookup(snapshot.PROM_METRICS_CLI))
|
||||||
viper.BindPFlag(snapshot.PROM_HTTP_TOML, rootCmd.PersistentFlags().Lookup(snapshot.PROM_HTTP_CLI))
|
viper.BindPFlag(snapshot.PROM_HTTP_TOML, rootCmd.PersistentFlags().Lookup(snapshot.PROM_HTTP_CLI))
|
||||||
|
@ -89,7 +89,7 @@ func NewInPlaceSnapshotConfig() *Config {
|
|||||||
|
|
||||||
// Init Initialises config
|
// Init Initialises config
|
||||||
func (c *Config) Init(mode SnapshotMode) error {
|
func (c *Config) Init(mode SnapshotMode) error {
|
||||||
viper.BindEnv(LOGRUS_FILE_TOML, LOGRUS_FILE)
|
viper.BindEnv(LOG_FILE_TOML, LOG_FILE)
|
||||||
viper.BindEnv(ETH_NODE_ID_TOML, ETH_NODE_ID)
|
viper.BindEnv(ETH_NODE_ID_TOML, ETH_NODE_ID)
|
||||||
viper.BindEnv(ETH_CLIENT_NAME_TOML, ETH_CLIENT_NAME)
|
viper.BindEnv(ETH_CLIENT_NAME_TOML, ETH_CLIENT_NAME)
|
||||||
viper.BindEnv(ETH_GENESIS_BLOCK_TOML, ETH_GENESIS_BLOCK)
|
viper.BindEnv(ETH_GENESIS_BLOCK_TOML, ETH_GENESIS_BLOCK)
|
||||||
|
@ -23,8 +23,8 @@ const (
|
|||||||
SNAPSHOT_MODE = "SNAPSHOT_MODE"
|
SNAPSHOT_MODE = "SNAPSHOT_MODE"
|
||||||
SNAPSHOT_ACCOUNTS = "SNAPSHOT_ACCOUNTS"
|
SNAPSHOT_ACCOUNTS = "SNAPSHOT_ACCOUNTS"
|
||||||
|
|
||||||
LOGRUS_LEVEL = "LOGRUS_LEVEL"
|
LOG_LEVEL = "LOG_LEVEL"
|
||||||
LOGRUS_FILE = "LOGRUS_FILE"
|
LOG_FILE = "LOG_FILE"
|
||||||
|
|
||||||
PROM_METRICS = "PROM_METRICS"
|
PROM_METRICS = "PROM_METRICS"
|
||||||
PROM_HTTP = "PROM_HTTP"
|
PROM_HTTP = "PROM_HTTP"
|
||||||
@ -61,8 +61,8 @@ const (
|
|||||||
SNAPSHOT_MODE_TOML = "snapshot.mode"
|
SNAPSHOT_MODE_TOML = "snapshot.mode"
|
||||||
SNAPSHOT_ACCOUNTS_TOML = "snapshot.accounts"
|
SNAPSHOT_ACCOUNTS_TOML = "snapshot.accounts"
|
||||||
|
|
||||||
LOGRUS_LEVEL_TOML = "log.level"
|
LOG_LEVEL_TOML = "log.level"
|
||||||
LOGRUS_FILE_TOML = "log.file"
|
LOG_FILE_TOML = "log.file"
|
||||||
|
|
||||||
PROM_METRICS_TOML = "prom.metrics"
|
PROM_METRICS_TOML = "prom.metrics"
|
||||||
PROM_HTTP_TOML = "prom.http"
|
PROM_HTTP_TOML = "prom.http"
|
||||||
@ -99,8 +99,8 @@ const (
|
|||||||
SNAPSHOT_MODE_CLI = "snapshot-mode"
|
SNAPSHOT_MODE_CLI = "snapshot-mode"
|
||||||
SNAPSHOT_ACCOUNTS_CLI = "snapshot-accounts"
|
SNAPSHOT_ACCOUNTS_CLI = "snapshot-accounts"
|
||||||
|
|
||||||
LOGRUS_LEVEL_CLI = "log-level"
|
LOG_LEVEL_CLI = "log-level"
|
||||||
LOGRUS_FILE_CLI = "log-file"
|
LOG_FILE_CLI = "log-file"
|
||||||
|
|
||||||
PROM_METRICS_CLI = "prom-metrics"
|
PROM_METRICS_CLI = "prom-metrics"
|
||||||
PROM_HTTP_CLI = "prom-http"
|
PROM_HTTP_CLI = "prom-http"
|
||||||
|
@ -32,8 +32,8 @@ fi
|
|||||||
|
|
||||||
START_TIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
|
START_TIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
|
||||||
echo "Running the snapshot service" && \
|
echo "Running the snapshot service" && \
|
||||||
if [[ -n "$LOGRUS_FILE" ]]; then
|
if [[ -n "$LOG_FILE" ]]; then
|
||||||
$SETUID /app/ipld-eth-state-snapshot "$VDB_COMMAND" $* |& $SETUID tee ${LOGRUS_FILE}.console
|
$SETUID /app/ipld-eth-state-snapshot "$VDB_COMMAND" $* |& $SETUID tee ${LOG_FILE}.console
|
||||||
rc=$?
|
rc=$?
|
||||||
else
|
else
|
||||||
$SETUID /app/ipld-eth-state-snapshot "$VDB_COMMAND" $*
|
$SETUID /app/ipld-eth-state-snapshot "$VDB_COMMAND" $*
|
||||||
|
Loading…
Reference in New Issue
Block a user