Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
fix: Rename message_max_size environment variable into default_messag…
Browse files Browse the repository at this point in the history
…e_max_size (#61)
  • Loading branch information
maximecaruchet authored and yesnault committed Feb 14, 2018
1 parent 762c434 commit 35ac474
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ func init() {
flags.String("log-field-app-id", "", "Ex: --log_field_app_id=xxxx-yyyy")
viper.BindPFlag("log_field_app_id", flags.Lookup("log-field-app-id"))

flags.Int("message-max-size", 1000, "Default max length of messages in a newly created topic")
viper.BindPFlag("message_max_size", flags.Lookup("message-max-size"))
flags.Int("default-message-max-size", 1000, "Default max length of messages in a newly created topic")
viper.BindPFlag("default_message_max_size", flags.Lookup("default-message-max-size"))
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ func CheckAndFixText(message *tat.Message, topic tat.Topic) error {
return fmt.Errorf("Invalid Text:%s", message.Text)
}

maxLength := viper.GetInt("message_max_size")
maxLength := viper.GetInt("default_message_max_size")
if topic.MaxLength > 0 {
maxLength = topic.MaxLength
}
Expand Down
8 changes: 4 additions & 4 deletions api/topic/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func InitPrivateTopic() {
Topic: "/Private",
Description: "Private Topics",
DateCreation: time.Now().Unix(),
MaxLength: viper.GetInt("message_max_size"),
MaxLength: viper.GetInt("default_message_max_size"),
MaxReplies: tat.DefaultMessageMaxReplies,
CanForceDate: false,
CanUpdateMsg: false,
Expand Down Expand Up @@ -344,8 +344,8 @@ func Insert(topic *tat.Topic, u *tat.User) error {

topic.ID = bson.NewObjectId().Hex()
topic.DateCreation = time.Now().Unix()
topic.MaxLength = viper.GetInt("message_max_size") // topic MaxLenth messages
topic.MaxReplies = tat.DefaultMessageMaxReplies // topic max replies on a message
topic.MaxLength = viper.GetInt("default_message_max_size") // topic MaxLenth messages
topic.MaxReplies = tat.DefaultMessageMaxReplies // topic max replies on a message
topic.CanForceDate = false
topic.IsAutoComputeLabels = true
topic.IsAutoComputeTags = true
Expand Down Expand Up @@ -818,7 +818,7 @@ func SetParam(topic *tat.Topic, username string, recursive bool, maxLength, maxR
}

if maxLength <= 0 {
maxLength = viper.GetInt("message_max_size")
maxLength = viper.GetInt("default_message_max_size")
}

update := bson.M{
Expand Down

0 comments on commit 35ac474

Please sign in to comment.