Creates systemd service for APIs
[src/app-framework-main.git] / conf / unit / generate-unit-conf / provided.inc
1 dnl vim: set filetype=sysctl.conf.m4 syntax=sysctl.conf.m4:
2 ;-------------------------------------------------------------------------------
3 ;----        P R O V I D E D   A P I S                                      ----
4 ;-------------------------------------------------------------------------------
5
6 {{#provided-api}}
7
8 ;-------------------------------------------------------------------------------
9 ;----        T H E   S E R V I C E   O F   T H E   A P I                    ----
10 ;-------------------------------------------------------------------------------
11 %begin systemd-unit
12
13 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
14
15 %systemd-unit system
16 %systemd-unit service UNIT_NAME_API_BASE({{name}})@
17
18 [Unit]
19 Description=Provides api {{name}} for user %i
20 X-AFM-API-TYPE={{value}}
21
22 Requires=afm-user-setup@%i.service
23 After=afm-user-setup@%i.service
24
25 {{#value=ws|auto}}
26 Requires=UNIT_NAME_API_BASE({{name}})@%i.socket
27 After=UNIT_NAME_API_BASE({{name}})@%i.socket
28 {{/value=ws|auto}}
29
30 [Service]
31 Type=oneshot
32 RemainAfterExit=yes
33 {{#value=ws|auto}}
34 ExecStart=/bin/true
35 {{/value=ws|auto}}
36 dnl {{#value=link}}
37 dnl ExecStart=/bin/ln -s {{:#metadata.install-dir}}/ USER_RUN_DIR/apis/link/{{name}}
38 dnl {{/value=link}}
39
40 dnl %nl
41 dnl [Install]
42 dnl WantedBy=afm-user-session@.target
43 dnl %systemd-unit wanted-by afm-user-session@.target
44
45 %end systemd-unit
46
47
48 ;-------------------------------------------------------------------------------
49 ;----        T H E   S O C K E T   O F   T H E   A P I                      ----
50 ;-------------------------------------------------------------------------------
51 {{#value=ws|auto}}
52
53 %begin systemd-unit
54
55 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
56
57 %systemd-unit system
58 %systemd-unit socket UNIT_NAME_API_BASE({{name}})@
59 [Unit]
60 Description=Provides websocket api {{name}} for user %i
61 Requires=afm-user-setup@%i.service
62 After=afm-user-setup@%i.service
63 DefaultDependencies=no
64
65 [Socket]
66 SmackLabel=*
67 SmackLabelIPIn=System
68 SmackLabelIPOut=System
69 ListenStream=USER_RUN_DIR/apis/ws/{{name}}
70 FileDescriptorName={{name}}
71 Service=UNIT_NAME_SERVICE
72
73 %end systemd-unit
74
75
76 {{/value=ws|auto}}
77
78 {{/provided-api}}
79
80