FIGHTANGEL 2019-07-01
yaml部分
hdfs_path: "/user/hive/warehouse/dm_user.db/user_vod_time/create_time=" hdfs_host: "hdfsNode9" hdfs_port: "8020" eth_host: "http://127.0.0.1" eth_port: "8545" coin_password: "password"
golang部分
package config type config struct{ HDFSPath string `yaml:"hdfs_path"` HDFSHost string `yaml:"hdfs_host"` HDFSPort string `yaml:"hdfs_port"` EthHost string `yaml:"eth_host"` EthPort string `yaml:"eth_port"` EthCoinPassword string `yaml:"coin_password"` }
yaml文件
hdfs: { path: "/user/hive/warehouse/dm_user.db/user_vod_time/create_time=", host: "hdfsNode9", port: "8020" } eth: { host: "http://127.0.0.1", port: "8545", coin_password: "password", }
golang 文件——config包
type config struct { hdfs.HDFSConfig `yaml:"hdfs"` eth.EthConfig `yaml:"eth"` }
golang文件——eth包
type EthConfig struct { EthHost string `yaml:"host"` EthPort string `yaml:"port"` EthCoinPassword string `yaml:"coin_password"` }
golang文件——hdfs包
type HDFSConfig struct { HDFSPath string `yaml:"path"` HDFSHost string `yaml:"host"` HDFSPort string `yaml:"port"` }