@@ -25,14 +25,14 @@ defmodule Makina.Models.Application do
2525 are subject to changes and should never be relied on.
2626 These are:
2727 * `:__hash__` which is the hash of all properties (except the private ones)
28- * `:__docker__` specific internal configurations used for docker that are not (yet)
28+ * `:__docker__` specific internal configurations used for docker that are not (yet) public
2929 * `:__scope__` collects nesting levels in the makina file in order to reliably distinguish apps
3030 exposed to the DSL.
3131 """
3232
3333 alias Makina.Models.Internal
3434
35- @ hashable_keys ~w[ name docker_image docker_registry dockerfile env_vars volumes exposed_ports domains load_balancing_port] a
35+ @ hashable_keys ~w[ name docker_image docker_registry dockerfile env_vars volumes exposed_ports domains load_balancing_port privileged? ] a
3636
3737 @ derive { JSON.Encoder , [ ] }
3838 defstruct __hash__: nil ,
@@ -50,7 +50,8 @@ defmodule Makina.Models.Application do
5050 env_vars: [ ] ,
5151 exposed_ports: [ ] ,
5252 domains: [ ] ,
53- load_balancing_port: nil
53+ load_balancing_port: nil ,
54+ privileged?: false
5455
5556 def new ( opts ) do
5657 app = struct ( __MODULE__ , opts )
@@ -167,10 +168,16 @@ defmodule Makina.Models.Application do
167168 not ( is_nil ( docker_registry . user ) and is_nil ( docker_registry . password ) )
168169 end
169170
170- def set_private ( % __MODULE { } = app , key , value ) do
171+ def set_private ( % __MODULE__ { } = app , key , value ) do
171172 app |> Map . put ( key , value )
172173 end
173174
175+ def set_privileged ( % __MODULE__ { } = app , flag ) do
176+ app = % __MODULE__ { app | privileged?: flag }
177+
178+ set_private ( app , :__hash__ , hash ( app ) )
179+ end
180+
174181 defp hash ( % __MODULE__ { } = app ) do
175182 keys = @ hashable_keys |> Enum . sort ( )
176183
0 commit comments