Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nss-pam-webapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
magicfelix
nss-pam-webapi
Commits
49da288d
Verified
Commit
49da288d
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Use BASE_NAME constant everywhere isntead of hard-coded name
parent
a7216b77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/config.rs
+4
-2
4 additions, 2 deletions
src/config.rs
src/logging.rs
+3
-1
3 additions, 1 deletion
src/logging.rs
with
7 additions
and
3 deletions
src/config.rs
+
4
−
2
View file @
49da288d
...
...
@@ -13,11 +13,13 @@
* limitations under the License.
*/
use
crate
::
BASE_NAME
;
use
serde
::
de
::
Deserialize
;
extern
crate
config
;
const
DEFAULT_CONFIG_FILE
:
&
str
=
"/etc/
nss_pam_oidc"
;
const
DEFAULT_CONFIG_FILE
:
&
str
=
(
"/etc/
"
.to_string
()
+
BASE_NAME
)
.as_str
()
;
pub
fn
get_config
(
conf_args
:
Option
<
config
::
Config
>
)
->
config
::
Config
{
// Preset default configuration
...
...
@@ -35,7 +37,7 @@ pub fn get_config(conf_args: Option<config::Config>) -> config::Config {
conf
.merge
(
config
::
File
::
with_name
(
&
config_file
))
.ok
();
// Override configuration from environment variables
conf
.merge
(
config
::
Environment
::
with_prefix
(
"NSS_PAM_OIDC"
))
.ok
();
conf
.merge
(
config
::
Environment
::
with_prefix
(
BASE_NAME
.to_string
()
.to_uppercase
()
.as_str
()
))
.ok
();
// Override configuration from args passed on module loading (e.g. args in PAM stack)
conf
.merge
(
conf_args
)
.ok
();
...
...
This diff is collapsed.
Click to expand it.
src/logging.rs
+
3
−
1
View file @
49da288d
...
...
@@ -14,6 +14,8 @@
* limitations under the License.
*/
use
crate
::
BASE_NAME
;
use
std
::
process
;
use
std
::
convert
::
TryInto
;
...
...
@@ -24,7 +26,7 @@ pub fn setup_log(log_level: LevelFilter) {
let
formatter
=
Formatter3164
{
facility
:
Facility
::
LOG_AUTHPRIV
,
hostname
:
None
,
process
:
"nss_pam_oidc"
.into
(),
process
:
BASE_NAME
.into
(),
pid
:
process
::
id
()
.try_into
()
.unwrap_or_default
(),
};
let
logger
=
syslog
::
unix
(
formatter
)
.expect
(
"could not connect to syslog"
);
...
...
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