lila/app/Env.scala
Thibault Duplessis 5692f75148 Merge branch 'master' into persistentSeeks
* master:
  we don't need to know the opening ply
  remove unused opening configuration
  upgrade for latest mithril: window.m is no longer a thing
  mithril 0.1.27 and chessground 1.8.1
  sk "slovenčina" translation #10932. Author: xslyepov.
  sk "slovenčina" translation #10931. Author: xslyepov.
  le "1337" translation #10928. Author: Chess_Agent. Finished the last five sentences.
  de "Deutsch" translation #10927. Author: Dolg. 99 I guess it's the possibility to reset the password. Right now it means that it were reset already.
  ar "العربية" translation #10926. Author: Abd0.
  uk "українська" translation #10925. Author: IvTK.
  la "lingua Latīna" translation #10924. Author: Dr_King_Schultz.
  hu "Magyar" translation #10923. Author: Nigel-727.
  sl "slovenščina" translation #10922. Author: woodswoods. Better words  for certain translations in contex.
  is "Íslenska" translation #10920. Author: hjortur.
  da "Dansk" translation #10919. Author: KillerDwarf.
  lv "latviešu valoda" translation #10918. Author: krauzand.
  ru "русский язык" translation #10915. Author: XuMEPA.
  add donor star to server providers
  move license file to the root
2014-12-17 11:50:46 +01:00

136 lines
4.1 KiB
Scala

package lila.app
import akka.actor._
import com.typesafe.config.Config
final class Env(
config: Config,
system: ActorSystem,
appPath: String) {
val CliUsername = config getString "cli.username"
private val RendererName = config getString "app.renderer.name"
private val RouterName = config getString "app.router.name"
private val WebPath = config getString "app.web_path"
lazy val bus = lila.common.Bus(system)
lazy val preloader = new mashup.Preload(
lobby = Env.lobby.lobby,
lobbyVersion = () => Env.lobby.history.version,
featured = Env.tv.featured,
leaderboard = Env.user.cached.topToday.apply,
tourneyWinners = Env.tournament.winners.scheduled,
timelineEntries = Env.timeline.getter.userEntries _,
dailyPuzzle = Env.puzzle.daily,
streamsOnAir = () => Env.tv.streamsOnAir,
countRounds = Env.round.count,
seekApi = Env.lobby.seekApi)
lazy val userInfo = mashup.UserInfo(
countUsers = () => Env.user.countEnabled,
bookmarkApi = Env.bookmark.api,
relationApi = Env.relation.api,
gameCached = Env.game.cached,
crosstableApi = Env.game.crosstableApi,
postApi = Env.forum.postApi,
getRatingChart = Env.history.ratingChartApi.apply,
getRanks = Env.user.cached.ranking.getAll,
isDonor = Env.donation.isDonor) _
system.actorOf(Props(new actor.Renderer), name = RendererName)
system.actorOf(Props(new actor.Router(
baseUrl = Env.api.Net.BaseUrl,
protocol = Env.api.Net.Protocol,
domain = Env.api.Net.Domain
)), name = RouterName)
if (!Env.ai.ServerOnly) {
loginfo("[boot] Preloading modules")
List(Env.socket,
Env.site,
Env.tournament,
Env.lobby,
Env.game,
Env.setup,
Env.round,
Env.team,
Env.message,
Env.timeline,
Env.gameSearch,
Env.teamSearch,
Env.forumSearch,
Env.relation,
Env.report,
Env.notification,
Env.bookmark,
Env.pref,
Env.evaluation,
Env.chat,
Env.puzzle,
Env.tv,
Env.blog)
loginfo("[boot] Preloading complete")
}
if (Env.ai.ServerOnly) println("Running as AI server")
// if (config getBoolean "simulation.enabled") {
// lila.simulation.Env.current.start
// }
}
object Env {
lazy val current = "[boot] app" describes new Env(
config = lila.common.PlayApp.loadConfig,
system = lila.common.PlayApp.system,
appPath = lila.common.PlayApp withApp (_.path.getCanonicalPath))
def api = lila.api.Env.current
def db = lila.db.Env.current
def user = lila.user.Env.current
def security = lila.security.Env.current
def wiki = lila.wiki.Env.current
def hub = lila.hub.Env.current
def socket = lila.socket.Env.current
def message = lila.message.Env.current
def notification = lila.notification.Env.current
def i18n = lila.i18n.Env.current
def game = lila.game.Env.current
def bookmark = lila.bookmark.Env.current
def search = lila.search.Env.current
def gameSearch = lila.gameSearch.Env.current
def timeline = lila.timeline.Env.current
def forum = lila.forum.Env.current
def forumSearch = lila.forumSearch.Env.current
def team = lila.team.Env.current
def teamSearch = lila.teamSearch.Env.current
def ai = lila.ai.Env.current
def analyse = lila.analyse.Env.current
def mod = lila.mod.Env.current
def monitor = lila.monitor.Env.current
def site = lila.site.Env.current
def round = lila.round.Env.current
def lobby = lila.lobby.Env.current
def setup = lila.setup.Env.current
def importer = lila.importer.Env.current
def tournament = lila.tournament.Env.current
def relation = lila.relation.Env.current
def report = lila.report.Env.current
def pref = lila.pref.Env.current
def evaluation = lila.evaluation.Env.current
def chat = lila.chat.Env.current
def puzzle = lila.puzzle.Env.current
def coordinate = lila.coordinate.Env.current
def tv = lila.tv.Env.current
def blog = lila.blog.Env.current
def donation = lila.donation.Env.current
def qa = lila.qa.Env.current
def history = lila.history.Env.current
def worldMap = lila.worldMap.Env.current
def opening = lila.opening.Env.current
}