Skip to content

Commit

Permalink
global: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mojib committed Mar 5, 2024
1 parent 3cefde7 commit ff3493b
Show file tree
Hide file tree
Showing 5 changed files with 539 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.kfu
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN pip install --upgrade pip && \
COPY themes/KFU/variables.less /usr/local/lib/python3.9/site-packages/invenio_override/assets/semantic-ui/less/invenio_override/variables.less

COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH}
COPY ./invenio.cfg ${INVENIO_INSTANCE_PATH}
COPY ./themes/KFU/invenio.cfg ${INVENIO_INSTANCE_PATH}
COPY ./templates/ ${INVENIO_INSTANCE_PATH}/templates/
COPY ./app_data/ ${INVENIO_INSTANCE_PATH}/app_data/
COPY ./translations/ ${INVENIO_INSTANCE_PATH}/translations/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.mug
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN pip install --upgrade pip && \
COPY themes/MUG/variables.less /usr/local/lib/python3.9/site-packages/invenio_override/assets/semantic-ui/less/invenio_override/variables.less

COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH}
COPY ./invenio.cfg ${INVENIO_INSTANCE_PATH}
COPY ./themes/MUG/invenio.cfg ${INVENIO_INSTANCE_PATH}
COPY ./templates/ ${INVENIO_INSTANCE_PATH}/templates/
COPY ./app_data/ ${INVENIO_INSTANCE_PATH}/app_data/
COPY ./translations/ ${INVENIO_INSTANCE_PATH}/translations/
Expand Down
59 changes: 54 additions & 5 deletions invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ THEME_SITENAME = "instance"
# Frontpage title
THEME_FRONTPAGE_TITLE = "instance"
# Header logo
THEME_LOGO = 'images/invenio-rdm.svg'

#THEME_LOGO = 'images/invenio-rdm.svg'

# Invenio-App-RDM
# ===============
Expand Down Expand Up @@ -164,8 +163,8 @@ ACCOUNTS_LOCAL_LOGIN_ENABLED = True # enable local login
SECURITY_REGISTERABLE = True # local login: allow users to register
SECURITY_RECOVERABLE = True # local login: allow users to reset the password
SECURITY_CHANGEABLE = True # local login: allow users to change psw
SECURITY_CONFIRMABLE = True # local login: users can confirm e-mail address
SECURITY_LOGIN_WITHOUT_CONFIRMATION = False # require users to confirm email before being able to login
# SECURITY_CONFIRMABLE = True # local login: users can confirm e-mail address
SECURITY_LOGIN_WITHOUT_CONFIRMATION = True # require users to confirm email before being able to login

# Invenio-OAuthclient
# -------------------
Expand All @@ -191,4 +190,54 @@ OAISERVER_ID_PREFIX = "instance.com"
# Invenio-Search
# --------------

SEARCH_INDEX_PREFIX = "instance-"
SEARCH_INDEX_PREFIX = "instance-"


# Invenio-I18N
# ============
# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html
BABEL_DEFAULT_LOCALE = "en"
# Default time zone
BABEL_DEFAULT_TIMEZONE = "Europe/Vienna"
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
I18N_LANGUAGES = [("de", _("German"))]


# Extras
# --------------
#INVENIO_THEME_SHOW_FRONTPAGE_INTRO_SECTION=False
THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
"""Set True for frontpage Intrp."""


# Invenio-Override
# --------------

# # LOGO
#INVENIO_OVERRIDE_LOGO=images/MUG.svg
OVERRIDE_LOGO = "images/MUG.svg"
"""override logo"""

#INVENIO_OVERRIDE_FAVICON=mug.ico
OVERRIDE_FAVICON = "mug.ico"
"""override favicon"""

#INVENIO_OVERRIDE_PRODUCTION=True
OVERRIDE_PRODUCTION = True
"""Enable/Disable notice."""

#INVENIO_OVERRIDE_ICON=images/icon_use.png
OVERRIDE_ICON = "images/icon_use.png"
"""Icon used in login page"""

#INVENIO_OVERRIDE_CONTACT_FORM=False
OVERRIDE_CONTACT_FORM = False
"""Enable/Disable Contact form."""

#INVENIO_OVERRIDE_SHIBBOLETH=False
OVERRIDE_SHIBBOLETH = False
"""Set True if SAML is configured"""

#INVENIO_OVERRIDE_FRONTPAGE_RIGHT=False
OVERRIDE_FRONTPAGE_RIGHT = True
"""Frontpage right section"""
241 changes: 241 additions & 0 deletions themes/KFU/invenio.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
"""
InvenioRDM settings for instance project.
This file was automatically generated by 'invenio-cli init'.
For the full list of settings and their values, see
https://inveniordm.docs.cern.ch/reference/configuration/.
"""

from datetime import datetime
from invenio_i18n import lazy_gettext as _


def _(x): # needed to avoid start time failure with lazy strings
return x

# Flask
# =====
# See https://flask.palletsprojects.com/en/1.1.x/config/

# Define the value of the cache control header `max-age` returned by the server when serving
# public files. Files will be cached by the browser for the provided number of seconds.
# See flask documentation for more information:
# https://flask.palletsprojects.com/en/2.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT
SEND_FILE_MAX_AGE_DEFAULT = 300

# SECURITY WARNING: keep the secret key used in production secret!
# Do not commit it to a source code repository.
# TODO: Set
SECRET_KEY="CHANGE_ME"

# Since HAProxy and Nginx route all requests no matter the host header
# provided, the allowed hosts variable is set to localhost. In production it
# should be set to the correct host and it is strongly recommended to only
# route correct hosts to the application.
APP_ALLOWED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1']


# Flask-SQLAlchemy
# ================
# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/

# TODO: Set
SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://instance:instance@localhost/instance"


# Invenio-App
# ===========
# See https://invenio-app.readthedocs.io/en/latest/configuration.html

APP_DEFAULT_SECURE_HEADERS = {
'content_security_policy': {
'default-src': [
"'self'",
'data:', # for fonts
"'unsafe-inline'", # for inline scripts and styles
"blob:", # for pdf preview
# Add your own policies here (e.g. analytics)
],
},
'content_security_policy_report_only': False,
'content_security_policy_report_uri': None,
'force_file_save': False,
'force_https': True,
'force_https_permanent': False,
'frame_options': 'sameorigin',
'frame_options_allow_from': None,
'session_cookie_http_only': True,
'session_cookie_secure': True,
'strict_transport_security': True,
'strict_transport_security_include_subdomains': True,
'strict_transport_security_max_age': 31556926, # One year in seconds
'strict_transport_security_preload': False,
}


# Flask-Babel
# ===========
# See https://python-babel.github.io/flask-babel/#configuration

# Default locale (language)
BABEL_DEFAULT_LOCALE = 'en'
# Default time zone
BABEL_DEFAULT_TIMEZONE = 'Europe/Zurich'


# Invenio-I18N
# ============
# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html

# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
I18N_LANGUAGES = [
# ('de', _('German')),
# ('tr', _('Turkish')),
]


# Invenio-Theme
# =============
# See https://invenio-theme.readthedocs.io/en/latest/configuration.html

# Name used in header and UI
THEME_SITENAME = "KFU"
# Frontpage title
THEME_FRONTPAGE_TITLE = "KFU"
# Header logo
#THEME_LOGO = 'images/invenio-rdm.svg'

# Invenio-App-RDM
# ===============
# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html

# Instance's theme entrypoint file. Path relative to the ``assets/`` folder.
INSTANCE_THEME_FILE = './less/theme.less'


# Invenio-Records-Resources
# =========================
# See https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/config.py

# TODO: Set with your own hostname when deploying to production
SITE_UI_URL = "https://127.0.0.1"

SITE_API_URL = "https://127.0.0.1/api"

APP_RDM_DEPOSIT_FORM_DEFAULTS = {
"publication_date": lambda: datetime.now().strftime("%Y-%m-%d"),
"rights": [
{
"id": "cc-by-4.0",
"title": "Creative Commons Attribution 4.0 International",
"description": ("The Creative Commons Attribution license allows "
"re-distribution and re-use of a licensed work "
"on the condition that the creator is "
"appropriately credited."),
"link": "https://creativecommons.org/licenses/by/4.0/legalcode",
}
],
"publisher": "instance",
}

# See https://github.com/inveniosoftware/invenio-app-rdm/blob/master/invenio_app_rdm/config.py
APP_RDM_DEPOSIT_FORM_AUTOCOMPLETE_NAMES = 'search' # "search_only" or "off"

# Invenio-RDM-Records
# ===================
# See https://inveniordm.docs.cern.ch/customize/dois/
DATACITE_ENABLED = False
DATACITE_USERNAME = ""
DATACITE_PASSWORD = ""
DATACITE_PREFIX = ""
DATACITE_TEST_MODE = True
DATACITE_DATACENTER_SYMBOL = ""

# Authentication - Invenio-Accounts and Invenio-OAuthclient
# =========================================================
# See: https://inveniordm.docs.cern.ch/customize/authentication/

# Invenio-Accounts
# ----------------
# See https://github.com/inveniosoftware/invenio-accounts/blob/master/invenio_accounts/config.py
ACCOUNTS_LOCAL_LOGIN_ENABLED = True # enable local login
SECURITY_REGISTERABLE = True # local login: allow users to register
SECURITY_RECOVERABLE = True # local login: allow users to reset the password
SECURITY_CHANGEABLE = True # local login: allow users to change psw
# SECURITY_CONFIRMABLE = True # local login: users can confirm e-mail address
SECURITY_LOGIN_WITHOUT_CONFIRMATION = True # require users to confirm email before being able to login

# Invenio-OAuthclient
# -------------------
# See https://github.com/inveniosoftware/invenio-oauthclient/blob/master/invenio_oauthclient/config.py

OAUTHCLIENT_REMOTE_APPS = {} # configure external login providers

from invenio_oauthclient.views.client import auto_redirect_login
ACCOUNTS_LOGIN_VIEW_FUNCTION = auto_redirect_login # autoredirect to external login if enabled
OAUTHCLIENT_AUTO_REDIRECT_TO_EXTERNAL_LOGIN = False # autoredirect to external login

# Invenio-UserProfiles
# --------------------
USERPROFILES_READ_ONLY = False # allow users to change profile info (name, email, etc...)

# OAI-PMH
# =======
# See https://github.com/inveniosoftware/invenio-oaiserver/blob/master/invenio_oaiserver/config.py

OAISERVER_ID_PREFIX = "instance.com"
"""The prefix that will be applied to the generated OAI-PMH ids."""

# Invenio-Search
# --------------

SEARCH_INDEX_PREFIX = "instance-"


# Invenio-I18N
# ============
# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html
BABEL_DEFAULT_LOCALE = "en"
# Default time zone
BABEL_DEFAULT_TIMEZONE = "Europe/Vienna"
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
I18N_LANGUAGES = [("de", _("German"))]

# Extras
# --------------
#INVENIO_THEME_SHOW_FRONTPAGE_INTRO_SECTION=False
THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
"""Set True for frontpage Intrp."""

# Invenio-Override
# --------------

# # LOGO
#INVENIO_OVERRIDE_LOGO=images/MUG.svg
OVERRIDE_LOGO = "images/MUG.svg"
"""override logo"""

#INVENIO_OVERRIDE_FAVICON=mug.ico
OVERRIDE_FAVICON = "mug.ico"
"""override favicon"""

#INVENIO_OVERRIDE_PRODUCTION=True
OVERRIDE_PRODUCTION = True
"""Enable/Disable notice."""

#INVENIO_OVERRIDE_ICON=images/icon_use.png
OVERRIDE_ICON = "images/icon_use.png"
"""Icon used in login page"""

#INVENIO_OVERRIDE_CONTACT_FORM=False
OVERRIDE_CONTACT_FORM = False
"""Enable/Disable Contact form."""

#INVENIO_OVERRIDE_SHIBBOLETH=False
OVERRIDE_SHIBBOLETH = False
"""Set True if SAML is configured"""

#INVENIO_OVERRIDE_FRONTPAGE_RIGHT=False
OVERRIDE_FRONTPAGE_RIGHT = True
"""Frontpage right section"""
Loading

0 comments on commit ff3493b

Please sign in to comment.