| Conditions | 2 |
| Total Lines | 16 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package infrastructures |
||
| 13 | func ConnectInfluxDB(env env.IEnv) error { |
||
| 14 | var host string |
||
| 15 | var token string |
||
| 16 | if config.IsDevelopment() { |
||
| 17 | host = env.GetEnv("DEBUG_INFLUXDB_URL") |
||
| 18 | token = env.GetEnv("DEBUG_INFLUXDB_TOKEN") |
||
| 19 | } else { |
||
| 20 | host = env.GetEnv("INFLUXDB_URL") |
||
| 21 | token = env.GetEnv("INFLUXDB_TOKEN") |
||
| 22 | } |
||
| 23 | client := influxdb2.NewClient(host, token) |
||
| 24 | influxClient = &client |
||
| 25 | |||
| 26 | _, err := client.Health(context.Background()) |
||
| 27 | |||
| 28 | return err |
||
| 29 | } |
||
| 40 |