Skip to content

Commit

Permalink
probably fix in frameit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazzpirate committed Nov 3, 2023
1 parent 10a36f6 commit d2bdf6c
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,26 @@ object Server extends IOApp /*with TwitterServer with EndpointModule[IO]*/ {
private val archiveRoot = flag("archive-root", "", "Path to archive root (preferably without spaces), e.g. to a clone of <https://github.com/UFrameIT/archives>")
*/

def archiveRoot(): String = "C:/Users/nroux/Desktop/kwarc/mmt-archives"

def bindAddress(): String = ":8085"

def debug(): Boolean = true
def debug(): Boolean = _debug
private var _debug: Boolean = false

private case class Args(bindAddress: String = "", archiveRoot: String = "")
private def parse_args(args:List[String],ret:Args): Args = {
args match {
case Nil => ret
case "-debug" :: rest => _debug = true; parse_args(rest,ret)
case "-bind" :: addr :: rest => parse_args(rest,ret.copy(bindAddress = addr))
case "-archive-root" :: root :: rest => parse_args(rest,ret.copy(archiveRoot = root))
case _ :: rest => parse_args(rest,ret)
}
}
override def run(args: List[String]): IO[ExitCode] = {
val args_ = parse_args(args,Args())
if (debug()) {
println("Server started in debugging mode.")
}

val state = initServerState(File(archiveRoot()))

ConcreteServerEndpoints.createServer(state, bindAddress()).useForever.as(ExitCode.Success)
val state = initServerState(File(args_.archiveRoot))
ConcreteServerEndpoints.createServer(state, args_.bindAddress).useForever.as(ExitCode.Success)
}

def initServerState(archiveRoot: File): ServerState = {
Expand Down

0 comments on commit d2bdf6c

Please sign in to comment.