-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from linkernetworks/johnlin/remove-influxdb
Johnlin/remove influxdb
- Loading branch information
Showing
9 changed files
with
55 additions
and
99 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
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,41 @@ | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/linkernetworks/logger" | ||
"github.com/linkernetworks/mongo" | ||
"github.com/linkernetworks/redis" | ||
) | ||
|
||
type Config struct { | ||
Redis *redis.RedisConfig `json:"redis"` | ||
Mongo *mongo.MongoConfig `json:"mongo"` | ||
Logger logger.LoggerConfig `json:"logger"` | ||
|
||
// the version settings of the current application | ||
Version string `json:"version"` | ||
} | ||
|
||
func Read(path string) (c Config, err error) { | ||
file, err := os.Open(path) | ||
if err != nil { | ||
return c, fmt.Errorf("Failed to open the config file: %v\n", err) | ||
} | ||
defer file.Close() | ||
decoder := json.NewDecoder(file) | ||
if err := decoder.Decode(&c); err != nil { | ||
return c, fmt.Errorf("Failed to load the config file: %v\n", err) | ||
} | ||
return c, nil | ||
} | ||
|
||
func MustRead(path string) Config { | ||
c, err := Read(path) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return c | ||
} |
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
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