github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/libkb/runmode.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package libkb 5 6 import ( 7 "fmt" 8 ) 9 10 // StringToRunMode turns a string into a run-mode 11 func StringToRunMode(s string) (RunMode, error) { 12 switch s { 13 case string(DevelRunMode): 14 return DevelRunMode, nil 15 case string(ProductionRunMode): 16 return ProductionRunMode, nil 17 case string(StagingRunMode): 18 return StagingRunMode, nil 19 case "": 20 return NoRunMode, nil 21 default: 22 return NoRunMode, fmt.Errorf("unknown run mode: '%s'", s) 23 } 24 }