Skip to content

Commit 430ab9b

Browse files
committed
Introduce interface config#Flags
This commit introduces the `Flags` interface, which provides methods related to access the configuration file path specified via command line flags. This interface will be implemented by flag structs containing a switch for the configuration file path and will serve as an argument for a future library function that combines loading configurations from YAML files and environment variables.
1 parent 3271652 commit 430ab9b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

config/contracts.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,17 @@ type Validator interface {
1515
// returns an error if any value is invalid or missing when required.
1616
Validate() error
1717
}
18+
19+
// Flags is an interface that provides methods related to access the
20+
// configuration file path specified via command line flags.
21+
// This interface is meant to be implemented by flag structs containing
22+
// a switch for the configuration file path.
23+
type Flags interface {
24+
// GetConfigPath retrieves the path to the configuration file as specified by command line flags,
25+
// or returns a default path if none was provided.
26+
GetConfigPath() string
27+
28+
// IsExplicitConfigPath indicates whether the configuration file path was
29+
// explicitly set through command line flags.
30+
IsExplicitConfigPath() bool
31+
}

0 commit comments

Comments
 (0)