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
555fa516
Commit
555fa516
authored
Nov 14, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove configuration file from version control
parent
887d8703
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
6 deletions
+107
-6
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+8
-3
gargantext.template.ini
tools/gargantext.template.ini
+10
-3
gensecret.py
tools/gensecret.py
+28
-0
mkconf.sh
tools/mkconf.sh
+60
-0
No files found.
.gitignore
View file @
555fa516
...
...
@@ -2,3 +2,4 @@
__pycache__
/static
.env
gargantext.ini
Makefile
View file @
555fa516
.PHONY
:
dev prod env
.PHONY
:
dev prod env
conf
dev
:
env
dev
:
conf
env
@
echo
"• Installing dependencies..."
pipenv
install
--dev
@
echo
prod
:
env
prod
:
conf
env
@
echo
"• Installing dependencies..."
pipenv
install
@
echo
...
...
@@ -14,3 +14,8 @@ env:
@
echo
"• Setup django settings module..."
./tools/mkenv.sh
@
echo
conf
:
@
echo
"• Setup gargantext configuration..."
./tools/mkconf.sh
@
echo
gargantext
.ini
→
tools/gargantext.template
.ini
View file @
555fa516
[django]
DEBUG
=
True
SECRET_KEY
=
!%ktkh981)piil1%t5r0g4$^0=uvdafk!=f2x8djxy7_gq(n5%
DB_PASS
=
C8kdcUrAQy66U
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
{DEBUG}
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY
=
{SECRET_KEY}
# PostgreSQL access
DB_HOST
=
127.0.0.1
DB_PORT
=
5432
DB_NAME
=
{DB_NAME}
DB_USER
=
{DB_USER}
DB_PASS
=
{DB_PASS}
[uwsgi]
...
...
tools/gensecret.py
0 → 100755
View file @
555fa516
#!/usr/bin/env python
from
string
import
ascii_letters
as
L
,
digits
as
D
,
punctuation
as
P
from
random
import
SystemRandom
as
R
,
randint
def
gensecret
(
chars
,
min_len
=
20
,
max_len
=
None
):
bounds
=
(
min_len
,)
if
max_len
is
None
else
(
min_len
,
max_len
)
return
''
.
join
([
R
()
.
choice
(
chars
)
for
i
in
range
(
randint
(
*
bounds
))])
if
__name__
==
"__main__"
:
import
sys
charsets
=
{
'L'
:
L
,
'D'
:
D
,
'P'
:
P
}
chars
=
L
+
D
+
P
bounds
=
[]
for
arg
in
sys
.
argv
:
if
arg
.
isalpha
():
chars
=
''
.
join
(
charsets
.
get
(
c
,
""
)
for
c
in
arg
)
elif
arg
.
isdigit
()
and
len
(
bounds
)
<
2
:
bounds
.
append
(
int
(
arg
))
if
not
bounds
:
bounds
=
[
45
,
50
]
print
(
gensecret
(
chars
,
*
bounds
))
tools/mkconf.sh
0 → 100755
View file @
555fa516
#!/usr/bin/env bash
# Handle arguments
while
getopts
f option
;
do
case
"
${
option
}
"
in
f
)
FORCE
=
1
;;
esac
done
# Gargantext configuration file
[
-z
"
$GARGANTEXT_CONF
"
]
&&
GARGANTEXT_CONF
=
gargantext.ini
# Configuration template
TEMPLATE
=
tools/gargantext.template.ini
if
[
-f
"
$GARGANTEXT_CONF
"
-a
-z
"
$FORCE
"
]
;
then
echo
"Configuration file
$GARGANTEXT_CONF
already exists. To generate a"
\
"new configuration anyway you can do: ./tools/mkconf.sh -f"
exit
fi
D
=
$(
dirname
$GARGANTEXT_CONF
)
if
!
(
mkdir
-p
$D
&&
touch
$GARGANTEXT_CONF
2>/dev/null
)
;
then
echo
"Can't create
$GARGANTEXT_CONF
, please check permissions."
exit
1
fi
echo
"Generate secret key for Django..."
SECRET_KEY
=
$(
python ./tools/gensecret.py
)
echo
"PostgreSQL configuration..."
DB_NAME_DEFAULT
=
gargandb
DB_USER_DEFAULT
=
gargantua
read
-p
"Database name [
$DB_NAME_DEFAULT
]: "
DB_NAME
DB_NAME
=
${
DB_NAME
:-
$DB_NAME_DEFAULT
}
read
-p
"Database user [
$DB_USER_DEFAULT
]: "
DB_USER
DB_USER
=
${
DB_USER
:-
$DB_USER_DEFAULT
}
read
-s
-p
"Please provide the password for
$DB_USER
: "
DB_PASS
&&
echo
SECRET_KEY
=
$(
echo
-n
"
$SECRET_KEY
"
|
sed
-e
's/[\\\/&\"]/\\\\&/g'
)
DB_NAME
=
$(
echo
-n
"
$DB_NAME
"
|
sed
-e
's/[\\\/&\"]/\\\\&/g'
)
DB_USER
=
$(
echo
-n
"
$DB_USER
"
|
sed
-e
's/[\\\/&\"]/\\\\&/g'
)
DB_PASS
=
$(
echo
-n
"
$DB_PASS
"
|
sed
-e
's/[\\\/&\"]/\\\\&/g'
)
echo
"Generate configuration file from
$TEMPLATE
..."
sed
-E
-e
's/[{]DEBUG[}]/True/g'
\
-e
"s/[{]SECRET_KEY[}]/
$SECRET_KEY
/g"
\
-e
"s/[{]DB_NAME[}]/
$DB_NAME
/g"
\
-e
"s/[{]DB_USER[}]/
$DB_USER
/g"
\
-e
"s/[{]DB_PASS[}]/
$DB_PASS
/g"
\
"
$TEMPLATE
"
>
"
$GARGANTEXT_CONF
"
\
&&
echo
"Configuration written successfully in
$GARGANTEXT_CONF
."
[
-z
"
$DB_PASS
"
]
&&
echo
"You didn't provide any database password, please"
\
"edit
$GARGANTEXT_CONF
before running Gargantext."
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