Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
0474e8a8
Unverified
Commit
0474e8a8
authored
Apr 02, 2018
by
Stéphane Graber
Committed by
GitHub
Apr 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2247 from brauner/2018-03-31/expand_lxc_environment
confile: expand lxc.environment
parents
dae29309
5eab47bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+7
-0
confile.c
src/lxc/confile.c
+14
-0
No files found.
doc/lxc.container.conf.sgml.in
View file @
0474e8a8
...
@@ -2445,6 +2445,13 @@ dev/null proc/kcore none bind,relative 0 0
...
@@ -2445,6 +2445,13 @@ dev/null proc/kcore none bind,relative 0 0
lxc.environment = APP_ENV=production
lxc.environment = APP_ENV=production
lxc.environment = SYSLOG_SERVER=192.0.2.42
lxc.environment = SYSLOG_SERVER=192.0.2.42
</programlisting>
</programlisting>
<para>
It is possible to inherit host environment variables by setting the
name of the variable without a "=" sign. For example:
</para>
<programlisting>
lxc.environment = PATH
</programlisting>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
...
...
src/lxc/confile.c
View file @
0474e8a8
...
@@ -1096,7 +1096,21 @@ static int set_config_environment(const char *key, const char *value,
...
@@ -1096,7 +1096,21 @@ static int set_config_environment(const char *key, const char *value,
if
(
!
list_item
)
if
(
!
list_item
)
goto
on_error
;
goto
on_error
;
if
(
!
strchr
(
value
,
'='
))
{
const
char
*
env_val
;
const
char
*
env_key
=
value
;
const
char
*
env_var
[
3
]
=
{
0
};
env_val
=
getenv
(
env_key
);
if
(
!
env_val
)
goto
on_error
;
env_var
[
0
]
=
env_key
;
env_var
[
1
]
=
env_val
;
list_item
->
elem
=
lxc_string_join
(
"="
,
env_var
,
false
);
}
else
{
list_item
->
elem
=
strdup
(
value
);
list_item
->
elem
=
strdup
(
value
);
}
if
(
!
list_item
->
elem
)
if
(
!
list_item
->
elem
)
goto
on_error
;
goto
on_error
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment