MCPcopy Create free account
hub / github.com/gogs/gogs / Install

Function Install

internal/route/install.go:127–184  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

125}
126
127func Install(c *context.Context) {
128 f := form.Install{}
129
130 // Database settings
131 f.DbHost = conf.Database.Host
132 f.DbUser = conf.Database.User
133 f.DbName = conf.Database.Name
134 f.DbSchema = conf.Database.Schema
135 f.DbPath = conf.Database.Path
136
137 c.Data["CurDbOption"] = "PostgreSQL"
138 switch conf.Database.Type {
139 case "mysql":
140 c.Data["CurDbOption"] = "MySQL"
141 case "sqlite3":
142 c.Data["CurDbOption"] = "SQLite3"
143 }
144
145 // Application general settings
146 f.AppName = conf.App.BrandName
147 f.RepoRootPath = conf.Repository.Root
148
149 // Note(unknwon): it's hard for Windows users change a running user,
150 // so just use current one if config says default.
151 if conf.IsWindowsRuntime() && conf.App.RunUser == "git" {
152 f.RunUser = osutil.CurrentUsername()
153 } else {
154 f.RunUser = conf.App.RunUser
155 }
156
157 f.Domain = conf.Server.Domain
158 f.SSHPort = conf.SSH.Port
159 f.UseBuiltinSSHServer = conf.SSH.StartBuiltinServer
160 f.HTTPPort = conf.Server.HTTPPort
161 f.AppUrl = conf.Server.ExternalURL
162 f.LogRootPath = conf.Log.RootPath
163 f.DefaultBranch = conf.Repository.DefaultBranch
164
165 // E-mail service settings
166 if conf.Email.Enabled {
167 f.SMTPHost = conf.Email.Host
168 f.SMTPFrom = conf.Email.From
169 f.SMTPUser = conf.Email.User
170 }
171 f.RegisterConfirm = conf.Auth.RequireEmailConfirmation
172 f.MailNotify = conf.User.EnableEmailNotification
173
174 // Server and other services settings
175 f.OfflineMode = conf.Server.OfflineMode
176 f.DisableGravatar = conf.Picture.DisableGravatar
177 f.EnableFederatedAvatar = conf.Picture.EnableFederatedAvatar
178 f.DisableRegistration = conf.Auth.DisableRegistration
179 f.EnableCaptcha = conf.Auth.EnableRegistrationCaptcha
180 f.RequireSignInView = conf.Auth.RequireSigninView
181
182 form.Assign(f, c.Data)
183 c.Success(INSTALL)
184}

Callers

nothing calls this directly

Calls 4

IsWindowsRuntimeFunction · 0.92
CurrentUsernameFunction · 0.92
AssignFunction · 0.92
SuccessMethod · 0.80

Tested by

no test coverage detected