diff --git a/app/Models/Key.php b/app/Models/Key.php
index 0af2ce89ce4ea0d4df9ddab028e5ea8269b2db58..7748e1046cfc1de1fa3842435556a12c5bb2cf94 100644
--- a/app/Models/Key.php
+++ b/app/Models/Key.php
@@ -1,23 +1,29 @@
-<?php 
+<?php
 
 namespace App\Models;
 
-class Key{
+class Key
+{
     public $key;
     public $status; # valid key = true, invalid key = false, unidentified key = null
+    private $keyserver = "https://key.metager.de/";
 
-
-    public function __construct($key, $status = null){
+    public function __construct($key, $status = null)
+    {
         $this->key = $key;
         $this->status = $status;
+        if (getenv("APP_ENV") !== "production") {
+            $this->keyserver = "https://dev.key.metager.de/";
+        }
     }
 
     # always returns true or false
-    public function getStatus() {
-        if($this->key !== '' && $this->status === null) {
+    public function getStatus()
+    {
+        if ($this->key !== '' && $this->status === null) {
             $this->updateStatus();
         }
-        if($this->status === null || $this->status === false) {
+        if ($this->status === null || $this->status === false) {
             return false;
         } else {
             return true;
@@ -25,10 +31,10 @@ class Key{
     }
 
     
-    public function updateStatus() {
-        
+    public function updateStatus()
+    {
         try {
-            $link = "https://key.metager3.de/" . urlencode($this->key) . "/request-permission/api-access";
+            $link = $this->keyserver . urlencode($this->key) . "/request-permission/api-access";
             $result = json_decode(file_get_contents($link));
             if ($result->{'api-access'} == true) {
                 $this->status = true;
@@ -42,8 +48,8 @@ class Key{
         }
     }
 
-    public function requestPermission() {
-
+    public function requestPermission()
+    {
         $postdata = http_build_query(array(
             'dummy' => 0,
         ));
@@ -58,16 +64,16 @@ class Key{
         $context = stream_context_create($opts);
 
         try {
-            $link = "https://key.metager3.de/" . urlencode($this->key) . "/request-permission/api-access";
+            $link = $this->keyserver . urlencode($this->key) . "/request-permission/api-access";
             $result = json_decode(file_get_contents($link, false, $context));
             if ($result->{'api-access'} == true) {
                 return true;
             } else {
-                $this->status = false; 
+                $this->status = false;
                 return false;
             }
         } catch (\ErrorException $e) {
             return false;
         }
     }
-}
\ No newline at end of file
+}