-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial changes - reading all banned ips from db
- Loading branch information
Showing
4 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package models | ||
|
||
import "github.com/golang/glog" | ||
|
||
func InitializeModelsFromDB() { | ||
initializeBannedIpListModelFromDB() | ||
} | ||
|
||
func initializeBannedIpListModelFromDB() { | ||
ipAddressList, err := GetAllIpAddressesFromBannedIpsTable() | ||
if err != nil { | ||
glog.Errorf("Failed to load banned ip address from the DB") | ||
return | ||
} | ||
|
||
BannedIpAddresses = ipAddressList | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
// Copyright (c) 2021 Orange Forum authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package models | ||
|
||
import "github.com/jmoiron/sqlx" | ||
|
||
var DB *sqlx.DB | ||
// Copyright (c) 2021 Orange Forum authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package models | ||
|
||
import "github.com/jmoiron/sqlx" | ||
|
||
var DB *sqlx.DB | ||
|
||
var BannedIpAddresses []string |