1 /*
2  * sys-emu - A system emulator for tutorials
3  * Copyright (C) 2018 - 2019 osdevelopment-info
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  */
18 package info.osdevelopment.sysemu.config
19 
20 import com.typesafe.config.{Config, ConfigFactory}
21 import scala.util.Try
22 
23 /**
24   * The global configuration of the application, read from `application.conf`.
25   */
26 trait Configuration {
27 
28   /**
29     * The config read from the file.
30     */
31   val config: Config = ConfigFactory.load
32 
33   /**
34     * The service host read from the config file. By default `localhost` is used.
35     */
36   lazy val serviceHost: String = Try(config.getString("service.host")).getOrElse("localhost")
37 
38   /**
39     * The service port read from the config file. By default `8080` is used.
40     */
41   lazy val servicePort: Int = Try(config.getInt("service.port")).getOrElse(8080)
42 
43 }
Line Stmt Id Pos Tree Symbol Code
31 8 1071 - 1089 Apply com.typesafe.config.ConfigFactory.load com.typesafe.config.ConfigFactory.load()