Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
07d8acae
Commit
07d8acae
authored
Nov 16, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better logic in database setup
parent
3e63220d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
mkconf.sh
tools/mkconf.sh
+10
-8
No files found.
tools/mkconf.sh
View file @
07d8acae
...
@@ -108,13 +108,15 @@ echo "▸ PostgresREST configuration..."
...
@@ -108,13 +108,15 @@ echo "▸ PostgresREST configuration..."
PGREST_USER
=
authenticator
PGREST_USER
=
authenticator
PGREST_PASS
=
CHANGEME
PGREST_PASS
=
CHANGEME
PGREST_AUTO
=
false
if
$DB_ACCESS
&&
query
"
$PGREST_USER
"
"
$PGREST_PASS
"
""
;
then
if
$DB_ACCESS
;
then
read
-p
"
You should change password for database user
$PGREST_USER
, auto-generate a new one
? (Y/n) "
PGREST_CHANGE
read
-p
"
Auto-generate a password for database user
$PGREST_USER
? (Y/n) "
PGREST_CHANGE
# Generate a password with letters and digits between 12 and 20 chars
# Generate a password with letters and digits between 12 and 20 chars
PGREST_PASS
=
$(
pipenv run python ./tools/gensecret.py LD 12 20 2>/dev/null
)
PGREST_PASS
=
$(
pipenv run python ./tools/gensecret.py LD 12 20 2>/dev/null
)
if
[
"
${
PGREST_CHANGE
,,
}
"
=
"y"
]
;
then
if
[
-z
"
$PGREST_CHANGE
"
-o
"
${
PGREST_CHANGE
,,
}
"
=
"y"
]
;
then
query
"
$DB_USER
"
"
$DB_PASS
"
"ALTER ROLE
$PGREST_USER
PASSWORD '
$PGREST_PASS
'"
query
"
$DB_USER
"
"
$DB_PASS
"
"ALTER ROLE
$PGREST_USER
PASSWORD '
$PGREST_PASS
'"
&&
\
echo
"Changed
$PGREST_USER
password successfully."
&&
PGREST_AUTO
=
true
fi
fi
fi
fi
...
@@ -148,12 +150,12 @@ sed -E -e "s/[{]DB_URI[}]/$PGREST_DB_URI/g" \
...
@@ -148,12 +150,12 @@ sed -E -e "s/[{]DB_URI[}]/$PGREST_DB_URI/g" \
"
$POSTGREST_TEMPLATE
"
>
"
$POSTGREST_CONF
"
\
"
$POSTGREST_TEMPLATE
"
>
"
$POSTGREST_CONF
"
\
&&
echo
"PostgREST configuration written successfully in
$POSTGREST_CONF
."
&&
echo
"PostgREST configuration written successfully in
$POSTGREST_CONF
."
if
[
-z
"
$DB_PASS
"
]
;
then
if
!
$DB_ACCESS
;
then
echo
"WARNING:
You didn't provide any database password
, please"
\
echo
"WARNING:
Couldn't configure database access correctly
, please"
\
"edit
$GARGANTEXT_CONF
before running Gargantext."
"edit
$GARGANTEXT_CONF
before running Gargantext."
fi
fi
if
!
$
DB_ACCESS
;
then
if
!
$
PGREST_AUTO
;
then
echo
"WARNING:
Couldn't configure PostgREST user
$PGREST_USER
correctly
,"
\
echo
"WARNING:
Didn't configure PostgREST user
$PGREST_USER
,"
\
"you may need to edit
$POSTGREST_CONF
manually."
"you may need to edit
$POSTGREST_CONF
manually."
fi
fi
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