-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor SecretString in its own package
- Loading branch information
Showing
3 changed files
with
6 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package config | ||
|
||
import "github.com/prismelabs/prismeanalytics/internal/secretstring" | ||
|
||
// Postgres related options. | ||
type Postgres struct { | ||
Url SecretString | ||
Url secretstring.SecretString | ||
} | ||
|
||
// PostgresFromEnv loads postgres related options from environment variables. | ||
// This function panics if required environment variables are missing. | ||
func PostgresFromEnv() Postgres { | ||
return Postgres{ | ||
Url: NewSecretString(mustGetEnv("PRISME_POSTGRES_URL")), | ||
Url: secretstring.NewSecretString(mustGetEnv("PRISME_POSTGRES_URL")), | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
internal/config/secret_string.go → internal/secretstring/secret_string.go
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,4 +1,4 @@ | ||
package config | ||
package secretstring | ||
|
||
type SecretString struct { | ||
value string | ||
|
2 changes: 1 addition & 1 deletion
2
internal/config/secret_string_test.go → internal/secretstring/secret_string_test.go
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,4 +1,4 @@ | ||
package config | ||
package secretstring | ||
|
||
import ( | ||
"bytes" | ||
|