-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
- Loading branch information
1 parent
1968a73
commit 11bc6ce
Showing
7 changed files
with
44 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/caarlos0/env/v11" | ||
) | ||
|
||
type MQTTProxyConfig struct { | ||
BrokerURL string `json:"broker_url"` | ||
Password string `json:"password"` | ||
PropletID string `json:"proplet_id"` | ||
ChannelID string `json:"channel_id"` | ||
BrokerURL string `env:"BROKER_URL" envDefault:""` | ||
Password string `env:"PASSWORD" envDefault:""` | ||
PropletID string `env:"PROPLET_ID" envDefault:""` | ||
ChannelID string `env:"CHANNEL_ID" envDefault:""` | ||
} | ||
|
||
func LoadMQTTConfig(opts env.Options) (*MQTTProxyConfig, error) { | ||
c := MQTTProxyConfig{} | ||
if err := env.ParseWithOptions(&c, opts); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &c, nil | ||
} |
This file was deleted.
Oops, something went wrong.
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