Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
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
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
68efddb5
Commit
68efddb5
authored
1 year ago
by
Katharina Renk
Browse files
Options
Downloads
Patches
Plain Diff
changed permissions for config directory
parent
e263d51a
No related branches found
No related tags found
1 merge request
!730
Resolve "Fix "Config file not found and was unable to create" on new gosdn repo environment"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cli/cmd/root.go
+2
-2
2 additions, 2 deletions
cli/cmd/root.go
with
2 additions
and
2 deletions
cli/cmd/root.go
+
2
−
2
View file @
68efddb5
...
@@ -110,12 +110,12 @@ func initConfig() {
...
@@ -110,12 +110,12 @@ func initConfig() {
if
err
:=
viper
.
ReadInConfig
();
err
!=
nil
{
if
err
:=
viper
.
ReadInConfig
();
err
!=
nil
{
if
ok
:=
errors
.
As
(
err
,
&
viper
.
ConfigFileNotFoundError
{});
ok
{
if
ok
:=
errors
.
As
(
err
,
&
viper
.
ConfigFileNotFoundError
{});
ok
{
// create folder if it does not exist
// create folder if it does not exist
if
err
:=
os
.
MkdirAll
(
defaultPath
,
0
6
00
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
defaultPath
,
0
7
00
);
err
!=
nil
{
log
.
Error
(
"Config directory not found and was unable to create, error: "
,
err
)
log
.
Error
(
"Config directory not found and was unable to create, error: "
,
err
)
}
}
// Config file not found
// Config file not found
// Try to create empty config file
// Try to create empty config file
if
err
=
os
.
WriteFile
(
fmt
.
Sprintf
(
"%s%s"
,
defaultPath
,
configFileName
),
[]
byte
(
""
),
0
6
00
);
err
!=
nil
{
if
err
=
os
.
WriteFile
(
fmt
.
Sprintf
(
"%s%s"
,
defaultPath
,
configFileName
),
[]
byte
(
""
),
0
7
00
);
err
!=
nil
{
log
.
Error
(
"Config file not found and was unable to create, error: "
,
err
)
log
.
Error
(
"Config file not found and was unable to create, error: "
,
err
)
}
}
}
else
{
}
else
{
...
...
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