Merge pull request #9680 from JimMoen/fix-influxdb-api
fix(influxdb): authentication is not required for influxdb v1 api
This commit is contained in:
commit
050d245fa5
|
@ -0,0 +1 @@
|
|||
Fix the problem that username and password authentication is mandatory in Influxdb v1 write API.
|
|
@ -0,0 +1 @@
|
|||
修复 InfluxDB v1 桥接写入 API 配置中强制需要用户名密码认证的问题。
|
|
@ -278,19 +278,18 @@ client_config(
|
|||
] ++ protocol_config(Config).
|
||||
|
||||
%% api v1 config
|
||||
protocol_config(#{
|
||||
username := Username,
|
||||
password := Password,
|
||||
protocol_config(
|
||||
#{
|
||||
database := DB,
|
||||
ssl := SSL
|
||||
}) ->
|
||||
} = Config
|
||||
) ->
|
||||
[
|
||||
{protocol, http},
|
||||
{version, v1},
|
||||
{username, str(Username)},
|
||||
{password, str(Password)},
|
||||
{database, str(DB)}
|
||||
] ++ ssl_config(SSL);
|
||||
] ++ username(Config) ++
|
||||
password(Config) ++ ssl_config(SSL);
|
||||
%% api v2 config
|
||||
protocol_config(#{
|
||||
bucket := Bucket,
|
||||
|
@ -321,6 +320,16 @@ ssl_config(SSL = #{enable := true}) ->
|
|||
{transport, ssl}
|
||||
] ++ maps:to_list(maps:remove(enable, SSL)).
|
||||
|
||||
username(#{username := Username}) ->
|
||||
[{username, str(Username)}];
|
||||
username(_) ->
|
||||
[].
|
||||
|
||||
password(#{password := Password}) ->
|
||||
[{password, str(Password)}];
|
||||
password(_) ->
|
||||
[].
|
||||
|
||||
%% -------------------------------------------------------------------------------------------------
|
||||
%% Query
|
||||
do_query(InstId, Client, Points) ->
|
||||
|
|
Loading…
Reference in New Issue