MCPcopy
hub / github.com/EverythingSuckz/TG-FileStreamBot / Load

Function Load

config/config.go:201–234  ·  view source on GitHub ↗
(log *zap.Logger, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

199}
200
201func Load(log *zap.Logger, cmd *cobra.Command) {
202 log = log.Named("Config")
203 defer log.Info("Loaded config")
204 ValueOf.setupEnvVars(log, cmd)
205 ValueOf.LogChannelID = int64(stripInt(log, int(ValueOf.LogChannelID)))
206 if ValueOf.HashLength == 0 {
207 log.Sugar().Info("HASH_LENGTH can't be 0, defaulting to 6")
208 ValueOf.HashLength = 6
209 }
210 if ValueOf.HashLength > 32 {
211 log.Sugar().Info("HASH_LENGTH can't be more than 32, changing to 32")
212 ValueOf.HashLength = 32
213 }
214 if ValueOf.HashLength < 5 {
215 log.Sugar().Info("HASH_LENGTH can't be less than 5, defaulting to 6")
216 ValueOf.HashLength = 6
217 }
218 if ValueOf.StreamConcurrency <= 0 {
219 log.Sugar().Info("STREAM_CONCURRENCY must be greater than 0, defaulting to 4")
220 ValueOf.StreamConcurrency = 4
221 }
222 if ValueOf.StreamBufferCount <= 0 {
223 log.Sugar().Info("STREAM_BUFFER_COUNT must be greater than 0, defaulting to 8")
224 ValueOf.StreamBufferCount = 8
225 }
226 if ValueOf.StreamTimeoutSec <= 0 {
227 log.Sugar().Info("STREAM_TIMEOUT_SEC must be greater than 0, defaulting to 30 seconds")
228 ValueOf.StreamTimeoutSec = 30
229 }
230 if ValueOf.StreamMaxRetries <= 0 {
231 log.Sugar().Info("STREAM_MAX_RETRIES must be greater than 0, defaulting to 3")
232 ValueOf.StreamMaxRetries = 3
233 }
234}
235
236func getIP(public bool) (string, error) {
237 var ip string

Callers 1

runAppFunction · 0.92

Calls 2

stripIntFunction · 0.85
setupEnvVarsMethod · 0.80

Tested by

no test coverage detected