diff options
author | Juan J. MartÃnez <jjm@usebox.net> | 2022-01-20 21:44:34 +0000 |
---|---|---|
committer | Juan J. MartÃnez <jjm@usebox.net> | 2022-01-20 21:44:34 +0000 |
commit | f90e7bad9f1df2d652b82048e9073096ddc8df18 (patch) | |
tree | c6f53976dfcb03cabf474a9c8528db44da762c2e /server/test/src/TestData.scala | |
parent | 397bee70a0baa6ab7cc2115c3a5dd555b381a49d (diff) | |
parent | aee32d5f42560ad0ff5d47034da699b3e608d2b4 (diff) | |
download | spacebeans-f90e7bad9f1df2d652b82048e9073096ddc8df18.tar.gz spacebeans-f90e7bad9f1df2d652b82048e9073096ddc8df18.zip |
Merge branch 'protocol-refactor' into 'main'
Protocol refactor
See merge request reidrac/spacebeans!2
Diffstat (limited to 'server/test/src/TestData.scala')
-rw-r--r-- | server/test/src/TestData.scala | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/server/test/src/TestData.scala b/server/test/src/TestData.scala new file mode 100644 index 0000000..df3fbd6 --- /dev/null +++ b/server/test/src/TestData.scala @@ -0,0 +1,108 @@ +package net.usebox.gemini.server + +import scala.concurrent.duration._ + +object TestData { + + val host = "localhost" + val port = 1965 + val portStr = port.toString() + + val conf = ServiceConf( + address = "127.0.0.1", + port = port, + defaultMimeType = "text/plain", + idleTimeout = 10.seconds, + virtualHosts = List( + VirtualHost( + host = host, + root = getClass.getResource("/").getPath() + ) + ), + genCertValidFor = 1.day, + enabledProtocols = Nil, + enabledCipherSuites = Nil + ) + + val cgiConf = ServiceConf.initConf( + conf.copy(virtualHosts = + List( + conf + .virtualHosts(0) + .copy( + directoryListing = true, + directories = List( + Directory( + "dir/", + directoryListing = Some(false), + allowCgi = Some(true) + ) + ) + ) + ) + ) + ) + + val cgiPrefConf = ServiceConf.initConf( + conf.copy(virtualHosts = + List( + conf + .virtualHosts(0) + .copy( + directoryListing = true, + directories = List( + Directory( + "dir/", + directoryListing = Some(false), + allowCgi = Some(true) + ), + Directory( + "dir/sub/", + directoryListing = Some(false), + allowCgi = Some(true) + ) + ) + ) + ) + ) + ) + + val cgiEnvConf = cgiConf.copy(virtualHosts = + List( + cgiConf + .virtualHosts(0) + .copy( + environment = Some(Map("env1" -> "value")) + ) + ) + ) + + val cgiIndexConf = cgiConf.copy(virtualHosts = + List( + cgiConf + .virtualHosts(0) + .copy( + indexFile = "cgi" + ) + ) + ) + + val confUserDir = conf.copy(virtualHosts = + List( + conf + .virtualHosts(0) + .copy( + userDirectories = true, + userDirectoryPath = Some( + getClass.getResource("/").getPath() + "{user}/public_gemini/" + ) + ) + ) + ) + + val mimeTypes = Some( + Map( + "config" -> List(".gmi", ".gemini") + ) + ) +} |