Skip to content

Commit 9b84158

Browse files
author
Olivier Bonnaure
committed
chores: replace \t by spaces
1 parent ae328a0 commit 9b84158

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+5159
-5160
lines changed

.init.lua

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ I18n = I18nClass.new("en")
1515
ProgramMaxPayloadSize(10485760) -- 10 MB
1616

1717
-- DB connection
18-
local db_config = DecodeJson(LoadAsset("config/database.json"))
19-
InitDB(db_config)
18+
--local db_config = DecodeJson(LoadAsset("config/database.json"))
19+
--InitDB(db_config)
2020

2121
Views = {}
2222
isApi = false
@@ -27,71 +27,70 @@ isApi = false
2727
LastModifiedAt = {}
2828

2929
function OnServerStart()
30-
LoadPublicAssetsRecursively("public")
31-
if BeansEnv == "production" then
32-
LoadViewsRecursively("app/views")
33-
end
30+
LoadPublicAssetsRecursively("public")
31+
if BeansEnv == "production" then
32+
LoadViewsRecursively("app/views")
33+
end
3434
end
3535

3636
function OnServerReload()
3737
end
3838

3939
function OnServerHeartbeat()
40-
LoadCronsJobs()
40+
LoadCronsJobs()
4141
end
4242

4343
function OnWorkerStart()
44-
-- Uncomment code if you use SQLite
45-
-- HandleSqliteFork(db_config) -- you can remove it if you do not use SQLite
44+
-- Uncomment code if you use SQLite
45+
-- HandleSqliteFork(db_config) -- you can remove it if you do not use SQLite
4646
end
4747

4848
-- OnError hook
4949
function OnError(status, message, details)
50-
-- Define the error for an API
51-
-- WriteJSON({ status = status, message = message })
52-
53-
-- Define the error page via a page with a layout
54-
Params.status = status
55-
Params.message = message
56-
Params.details = details
57-
Params.env = BeansEnv
58-
Page("errors/index", "app")
50+
-- Define the error for an API
51+
-- WriteJSON({ status = status, message = message })
52+
53+
-- Define the error page via a page with a layout
54+
Params.status = status
55+
Params.message = message
56+
Params.details = details
57+
Params.env = BeansEnv
58+
Page("errors/index", "app")
5959
end
6060

6161
-- OnHttpRequest hook
6262
function OnHttpRequest()
6363

64-
-- local redis = require "db.redis"
65-
-- Redis = redis.connect()
64+
-- local redis = require "db.redis"
65+
-- Redis = redis.connect()
6666

67-
Params = GetParams()
68-
PrepareMultiPartParams() -- if you handle file uploads
67+
Params = GetParams()
68+
PrepareMultiPartParams() -- if you handle file uploads
6969

70-
SetDevice() -- comment if you do not need this feature
70+
SetDevice() -- comment if you do not need this feature
7171

72-
-- Uncomment code if you use ArangoDB
73-
if Adb then
74-
Adb.primary:RefreshToken() -- reconnect to arangoDB if needed
75-
end
72+
-- Uncomment code if you use ArangoDB
73+
-- if Adb then
74+
-- Adb.primary:RefreshToken() -- reconnect to arangoDB if needed
75+
-- end
7676

77-
-- Uncomment code if you use surrealdb
78-
-- if (db_config ~= nil and db_config["engine"] == "surrealdb") then
79-
-- Surreal.refresh_token(db_config[BeansEnv]) -- reconnect to surrealdb if needed
80-
-- end
77+
-- Uncomment code if you use surrealdb
78+
-- if (db_config ~= nil and db_config["engine"] == "surrealdb") then
79+
-- Surreal.refresh_token(db_config[BeansEnv]) -- reconnect to surrealdb if needed
80+
-- end
8181

82-
DefineRoute(GetPath(), GetMethod())
82+
DefineRoute(GetPath(), GetMethod())
8383

84-
85-
HandleRequest()
86-
-- Uncomment if you use redis
87-
-- unix.close(Redis.network.socket)
84+
HandleRequest()
85+
-- Uncomment if you use redis
86+
-- unix.close(Redis.network.socket)
8887
end
8988

9089
function SetDevice()
91-
local user_agent = GetHeader("User-Agent")
92-
Params.request = { variant = "" }
93-
local preg = assert(re.compile("iPhone"))
94-
if preg:search(user_agent) then
95-
Params.request.variant = "iphone"
96-
end
90+
local user_agent = GetHeader("User-Agent")
91+
Params.request = { variant = "" }
92+
local preg = assert(re.compile("iPhone"))
93+
if preg:search(user_agent) then
94+
Params.request.variant = "iphone"
95+
end
9796
end

0 commit comments

Comments
 (0)