aboutsummaryrefslogtreecommitdiff
path: root/server/test/src/TestData.scala
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-01-16 00:22:24 +0000
committerJuan J. Martinez <jjm@usebox.net>2022-01-16 00:22:24 +0000
commit60d4dce0193fb9d592f2fe065908bfc88da89dff (patch)
tree4a96331789a475dfbd587eaef95c4f9504081a6b /server/test/src/TestData.scala
parent397bee70a0baa6ab7cc2115c3a5dd555b381a49d (diff)
downloadspacebeans-60d4dce0193fb9d592f2fe065908bfc88da89dff.tar.gz
spacebeans-60d4dce0193fb9d592f2fe065908bfc88da89dff.zip
Refactor Gemini protocol
Diffstat (limited to 'server/test/src/TestData.scala')
-rw-r--r--server/test/src/TestData.scala108
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")
+ )
+ )
+}