Skip to content

Commit

Permalink
Make config less noisy when not used directly here.
Browse files Browse the repository at this point in the history
  • Loading branch information
bahner committed Mar 17, 2024
1 parent 92ea747 commit ed2c66e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ KEYSET = $(NAME)-create-keyset
FETCH = $(NAME)-fetch-document
DEBUG = $(NAME)-debug
ANDROID = android-arm64
DARWIN = darwin-amd64 darwin-arm64
FREEBSD = freebsd-amd64 freebsd-arm64
LINUX = linux-amd64 linux-arm64 linux-mips64 linux-mips64le linux-ppc64 linux-ppc64le linux-s390x
NETBSD = netbsd-amd64 netbsd-arm64
OPENBSD = openbsd-amd64 openbsd-arm64
DARWIN = darwin-amd64
FREEBSD = freebsd-amd64
LINUX = linux-amd64 linux-mips64 linux-mips64le linux-ppc64 linux-ppc64le linux-s390x
NETBSD = netbsd-amd64
OPENBSD = openbsd-amd64
WINDOWS = windows-386 windows-amd64
PLATFORMS = $(ANDROID) $(DARWIN) $(FREEBSD) $(LINUX) $(NETBSD) $(OPENBSD) $(WINDOWS)
ARM64=android-arm64 darwin-arm64 netbsd-arm64 openbsd-arm64
Expand Down
12 changes: 6 additions & 6 deletions config/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func init() {
pflag.Bool("publish", false, "Publishes keyset to IPFS")
pflag.Bool("force", false, "Forces regneration of config keyset and publishing")

}

// Load a keyset from string and initiate an Actor.
// This is optional, but if you want to use the actor package, you need to call this.
func InitActor() {

pflag.StringP("nick", "n", defaultNick, "Nickname to use in character creation")
pflag.StringP("location", "l", defaultLocation, "DID of the location to visit")

Expand All @@ -40,12 +46,6 @@ func init() {
viper.BindPFlag("actor.location", pflag.Lookup("location"))
viper.SetDefault("actor.location", defaultLocation)

}

// Load a keyset from string and initiate an Actor.
// This is optional, but if you want to use the actor package, you need to call this.
func InitActor() {

keyset_string := actorIdentity()
if keyset_string == fakeActorIdentity {
panic(ErrFakeIdentity)
Expand Down
4 changes: 2 additions & 2 deletions config/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const (
defaultHttpRefresh int = 10
)

func init() {

func InitHTTP() {
pflag.String("http-socket", defaultHttpSocket, "Address for webserver to listen on")
pflag.Int("http-refresh", defaultHttpRefresh, "Number of seconds for webpages to wait before refresh")

Expand All @@ -21,6 +20,7 @@ func init() {
viper.SetDefault("http.socket", defaultHttpSocket)
viper.SetDefault("http.refresh", defaultHttpRefresh)

// This function is empty, but it is used to make sure that the init function is called.
}

func HttpSocket() string {
Expand Down
10 changes: 0 additions & 10 deletions config/mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const (
DEFAULT_PONG_FORTUNE_MODE = false
DEFAULT_PONG_FORTUNE_ARGS = "-s"

defaultPongMode = false
defaultRelayMode = false

pong = "pong"
relay = "relay"

Expand All @@ -23,13 +20,6 @@ var ErrConflictingModes = "Can't have both pong and relay mode enabled at the sa

// NB! This file is used early in the initialization process, so it can't depend on other packages.

func init() {
// NB! Other mode pflags are in the proper mode packages.
pflag.Bool("pong", defaultPongMode, "Pong mode with automatic replies and no UI.")
pflag.Bool("pong-fortune", DEFAULT_PONG_FORTUNE_MODE, "Reply with a fortune cookie, instead of a static message, if availble.")
pflag.Bool("relay", defaultRelayMode, "Relay mode with no actor, to just listen and relay messages.")
}

// If actor.home is set to pong, then we are in pong mode.
// THIs means that we don't render the ui and reply automatically to messages.
func PongMode() bool {
Expand Down

0 comments on commit ed2c66e

Please sign in to comment.