forked from ktorio/ktor-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevelopment_mode.xml
105 lines (96 loc) · 4.6 KB
/
development_mode.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic SYSTEM "https://resources.jetbrains.com/stardust/html-entities.dtd">
<topic xmlns="" xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/stardust/topic.v2.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="development_mode" title="Development mode">
<p>
Ktor provides a special mode targeted for development. This mode enables the following capabilities:
</p>
<list>
<li><a href="Auto_reload.xml">Auto-reload</a> for reloading application classes
without restarting the server.
</li>
<li>Extended information for debugging <a href="Pipelines.md">pipelines</a> (with stack
traces).
</li>
<li>Extended debugging information on a <a href="status_pages.md">response page</a> in
a case of a <emphasis>5**</emphasis> server error.
</li>
</list>
<note>
<p>
Note that development mode affects performance and shouldn't be used in production.
</p>
</note>
<chapter title="Enable development mode" id="enable">
<p>
You can enable development mode in different ways: in the application configuration file,
using a dedicated system property or environment variable.
</p>
<chapter title="application.conf" id="application-conf">
<p>
To enable development mode in the
<a href="Configurations.xml" anchor="hocon-file">application.conf</a> file,
set the <code>development</code> option to <code>true</code>:
</p>
<code style="block">
ktor {
development = true
}
</code>
</chapter>
<chapter title="The 'io.ktor.development' system property" id="system-property">
<p>
The <control>io.ktor.development</control> <a href="https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html">system property</a>
allows you to enable development mode when running your application:
</p>
<list>
<li>
<p>
To run an application in development mode using IntelliJ IDEA,
pass <code>io.ktor.development</code> with the <code>-D</code> flag to
<a href="https://www.jetbrains.com/help/idea/run-debug-configuration-kotlin.html#1">VM options</a>:
</p>
<code style="block">
-Dio.ktor.development=true
</code>
</li>
<li>
<p>
If you run your application using a <a href="server-dependencies.xml">Gradle</a> task, you can pass
<code>io.ktor.development</code> to the
<code>applicationDefaultJvmArgs</code> property in a <path>build.gradle(.kts)</path> file:
</p>
<tabs group="languages">
<tab title="Gradle (Kotlin)" group-key="kotlin">
<code style="block" lang="Kotlin">
application {
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=true")
}
</code>
</tab>
<tab title="Gradle (Groovy)" group-key="groovy">
<code style="block" lang="Groovy">
application {
applicationDefaultJvmArgs = ["-Dio.ktor.development=true"]
}
</code>
</tab>
</tabs>
</li>
</list>
<tip>
<p>
You can also use the <code>-ea</code> flag to enable development mode.
Note that the <code>io.ktor.development</code> system property passed with the <code>-D</code> flag
takes precedence over <code>-ea</code>.
</p>
</tip>
</chapter>
<chapter title="The 'io.ktor.development' environment variable" id="environment-variable">
<p>
To enable development mode for a <a href="http-client_engines.md" anchor="native">Native client</a>,
use the <code>io.ktor.development</code> environment variable.
</p>
</chapter>
</chapter>
</topic>