Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Anything Llm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
Mintplex Labs
Anything Llm
Commits
9411791f
Commit
9411791f
authored
9 months ago
by
timothycarambat
Browse files
Options
Downloads
Patches
Plain Diff
Simplify ENV management
auto write ENV on changes Dont double-track envs that are already tracked
parent
524edd6e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/endpoints/api/system/index.js
+0
-1
0 additions, 1 deletion
server/endpoints/api/system/index.js
server/endpoints/system.js
+0
-4
0 additions, 4 deletions
server/endpoints/system.js
server/utils/helpers/updateENV.js
+3
-10
3 additions, 10 deletions
server/utils/helpers/updateENV.js
with
3 additions
and
15 deletions
server/endpoints/api/system/index.js
+
0
−
1
View file @
9411791f
...
@@ -145,7 +145,6 @@ function apiSystemEndpoints(app) {
...
@@ -145,7 +145,6 @@ function apiSystemEndpoints(app) {
try
{
try
{
const
body
=
reqBody
(
request
);
const
body
=
reqBody
(
request
);
const
{
newValues
,
error
}
=
await
updateENV
(
body
);
const
{
newValues
,
error
}
=
await
updateENV
(
body
);
if
(
process
.
env
.
NODE_ENV
===
"
production
"
)
await
dumpENV
();
response
.
status
(
200
).
json
({
newValues
,
error
});
response
.
status
(
200
).
json
({
newValues
,
error
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
,
e
);
console
.
log
(
e
.
message
,
e
);
...
...
This diff is collapsed.
Click to expand it.
server/endpoints/system.js
+
0
−
4
View file @
9411791f
...
@@ -416,7 +416,6 @@ function systemEndpoints(app) {
...
@@ -416,7 +416,6 @@ function systemEndpoints(app) {
false
,
false
,
response
?.
locals
?.
user
?.
id
response
?.
locals
?.
user
?.
id
);
);
if
(
process
.
env
.
NODE_ENV
===
"
production
"
)
await
dumpENV
();
response
.
status
(
200
).
json
({
newValues
,
error
});
response
.
status
(
200
).
json
({
newValues
,
error
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
,
e
);
console
.
log
(
e
.
message
,
e
);
...
@@ -451,8 +450,6 @@ function systemEndpoints(app) {
...
@@ -451,8 +450,6 @@ function systemEndpoints(app) {
true
true
)?.
error
;
)?.
error
;
}
}
if
(
process
.
env
.
NODE_ENV
===
"
production
"
)
await
dumpENV
();
response
.
status
(
200
).
json
({
success
:
!
error
,
error
});
response
.
status
(
200
).
json
({
success
:
!
error
,
error
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
message
,
e
);
console
.
log
(
e
.
message
,
e
);
...
@@ -493,7 +490,6 @@ function systemEndpoints(app) {
...
@@ -493,7 +490,6 @@ function systemEndpoints(app) {
},
},
true
true
);
);
if
(
process
.
env
.
NODE_ENV
===
"
production
"
)
await
dumpENV
();
await
Telemetry
.
sendTelemetry
(
"
enabled_multi_user_mode
"
,
{
await
Telemetry
.
sendTelemetry
(
"
enabled_multi_user_mode
"
,
{
multiUserMode
:
true
,
multiUserMode
:
true
,
});
});
...
...
This diff is collapsed.
Click to expand it.
server/utils/helpers/updateENV.js
+
3
−
10
View file @
9411791f
...
@@ -719,6 +719,7 @@ async function updateENV(newENVs = {}, force = false, userId = null) {
...
@@ -719,6 +719,7 @@ async function updateENV(newENVs = {}, force = false, userId = null) {
}
}
await
logChangesToEventLog
(
newValues
,
userId
);
await
logChangesToEventLog
(
newValues
,
userId
);
if
(
process
.
env
.
NODE_ENV
===
"
production
"
)
await
dumpENV
();
return
{
newValues
,
error
:
error
?.
length
>
0
?
error
:
false
};
return
{
newValues
,
error
:
error
?.
length
>
0
?
error
:
false
};
}
}
...
@@ -751,6 +752,8 @@ async function dumpENV() {
...
@@ -751,6 +752,8 @@ async function dumpENV() {
const
frozenEnvs
=
{};
const
frozenEnvs
=
{};
const
protectedKeys
=
[
const
protectedKeys
=
[
...
Object
.
values
(
KEY_MAPPING
).
map
((
values
)
=>
values
.
envKey
),
...
Object
.
values
(
KEY_MAPPING
).
map
((
values
)
=>
values
.
envKey
),
// Manually Add Keys here which are not already defined in KEY_MAPPING
// and are either managed or manually set ENV key:values.
"
STORAGE_DIR
"
,
"
STORAGE_DIR
"
,
"
SERVER_PORT
"
,
"
SERVER_PORT
"
,
// Password Schema Keys if present.
// Password Schema Keys if present.
...
@@ -765,16 +768,6 @@ async function dumpENV() {
...
@@ -765,16 +768,6 @@ async function dumpENV() {
"
ENABLE_HTTPS
"
,
"
ENABLE_HTTPS
"
,
"
HTTPS_CERT_PATH
"
,
"
HTTPS_CERT_PATH
"
,
"
HTTPS_KEY_PATH
"
,
"
HTTPS_KEY_PATH
"
,
// DISABLED TELEMETRY
"
DISABLE_TELEMETRY
"
,
// Agent Integrations
// Search engine integrations
"
AGENT_GSE_CTX
"
,
"
AGENT_GSE_KEY
"
,
"
AGENT_SERPER_DEV_KEY
"
,
"
AGENT_BING_SEARCH_API_KEY
"
,
"
AGENT_SERPLY_API_KEY
"
,
];
];
// Simple sanitization of each value to prevent ENV injection via newline or quote escaping.
// Simple sanitization of each value to prevent ENV injection via newline or quote escaping.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment