refactor: delete default authz config from emqx.conf
This commit is contained in:
parent
7c5a9e0e20
commit
5acf0e281e
|
@ -2,14 +2,4 @@ authorization {
|
|||
deny_action = ignore
|
||||
no_match = allow
|
||||
cache = { enable = true }
|
||||
sources = [
|
||||
{
|
||||
type = file
|
||||
enable = true
|
||||
# This file is immutable to EMQX.
|
||||
# Once new rules are created from dashboard UI or HTTP API,
|
||||
# the file 'data/authz/acl.conf' is used instead of this one
|
||||
path = "{{ platform_etc_dir }}/acl.conf"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
description() ->
|
||||
"AuthZ with static rules".
|
||||
|
||||
create(#{path := Path} = Source) ->
|
||||
create(#{path := Path0} = Source) ->
|
||||
Path = emqx_schema:naive_env_interpolation(Path0),
|
||||
Rules =
|
||||
case file:consult(Path) of
|
||||
{ok, Terms} ->
|
||||
|
|
|
@ -491,7 +491,7 @@ authz_fields() ->
|
|||
?HOCON(
|
||||
?ARRAY(?UNION(UnionMemberSelector)),
|
||||
#{
|
||||
default => [],
|
||||
default => [default_authz()],
|
||||
desc => ?DESC(sources),
|
||||
%% doc_lift is force a root level reference instead of nesting sub-structs
|
||||
extra => #{doc_lift => true},
|
||||
|
@ -501,3 +501,10 @@ authz_fields() ->
|
|||
}
|
||||
)}
|
||||
].
|
||||
|
||||
default_authz() ->
|
||||
#{
|
||||
<<"type">> => <<"file">>,
|
||||
<<"enable">> => true,
|
||||
<<"path">> => <<"${EMQX_ETC_DIR}/acl.conf">>
|
||||
}.
|
||||
|
|
Loading…
Reference in New Issue