Merge branch 'master' into queries-to-mutations

This commit is contained in:
Moriz Wahl 2021-09-23 12:02:30 +02:00
commit 25833f58b4
19 changed files with 117 additions and 39 deletions

1
.env.local.dist Normal file
View File

@ -0,0 +1 @@
// for local .env entries

1
.env.shell Normal file
View File

@ -0,0 +1 @@
BUILD_COMMIT="$(git rev-parse HEAD)"

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ messages.pot
.skeema
nbproject
.metadata
/.env

2
database/build/.env.dist Normal file
View File

@ -0,0 +1,2 @@
// For production you need to put your env file in here.
// Please copy the dist file from the root folder in here and rename it to .env

View File

@ -2,7 +2,10 @@
# For that to work, node v12.19.0 needs to be installed with nvm for root
# or NPM_BIN Path and NVM_DIR must be adjusted
cd /var/www/html/gradido/frontend
cd /var/www/html/gradido
eval "echo \"$(cat .env.shell)\"" > .env
export BUILD_COMMIT="$(git rev-parse HEAD)"
cd frontend
NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm

View File

@ -13,7 +13,6 @@ services:
environment:
- NODE_ENV="development"
# - DEBUG=true
- NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/`
volumes:
# This makes sure the docker container has its own node modules.
# Therefore it is possible to have a different node version on the host machine
@ -140,11 +139,13 @@ services:
build:
context: .
dockerfile: ./skeema/Dockerfile
target: skeema_run
target: skeema_dev_run
depends_on:
- mariadb
networks:
- internal-net
volumes:
- ./login_server/skeema/gradido_login:/skeema/gradido_login
volumes:
frontend_node_modules:

View File

@ -22,14 +22,13 @@ services:
# Envs used in Dockerfile
# - DOCKER_WORKDIR="/app"
# - PORT=3000
- BUILD_DATE
- BUILD_VERSION
- BUILD_COMMIT
# - BUILD_DATE="1970-01-01T00:00:00.00Z"
# - BUILD_VERSION="0.0.0.0"
# - BUILD_COMMIT="0000000"
- NODE_ENV="production"
# Application only envs
#- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp
#env_file:
# - ./frontend/.env
# env_file:
# - ./.env
# - ./frontend/.env
#########################################################
## MARIADB ##############################################
@ -157,6 +156,19 @@ services:
volumes:
- ./community_server/config/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
#########################################################
## skeema for updating dbs if changes happend ###########
#########################################################
skeema:
build:
context: .
dockerfile: ./skeema/Dockerfile
target: skeema_run
depends_on:
- mariadb
networks:
- internal-net
#########################################################
## GRADIDO NODE v1 ######################################
#########################################################

View File

@ -2,3 +2,4 @@ LOGIN_API_URL=http://localhost/login_api/
COMMUNITY_API_URL=http://localhost/api/
ALLOW_REGISTER=true
GRAPHQL_URI=http://localhost:4000/graphql
//BUILD_COMMIT=0000000

View File

@ -1,13 +1,20 @@
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env).
// The whole contents is exposed to the client
// Load Package Details for some default values
const pkg = require('../../package')
const version = {
APP_VERSION: pkg.version,
BUILD_COMMIT: process.env.BUILD_COMMIT || null,
// self reference of `version.BUILD_COMMIT` is not possible at this point, hence the duplicate code
BUILD_COMMIT_SHORT: (process.env.BUILD_COMMIT || '0000000').substr(0, 7),
}
const environment = {
NODE_ENV: process.env.NODE_ENV,
DEBUG: process.env.NODE_ENV !== 'production' || false,
PRODUCTION: process.env.NODE_ENV === 'production' || false,
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
}
const server = {
@ -16,10 +23,15 @@ const server = {
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
}
const options = {
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
}
const CONFIG = {
...version,
...environment,
...server,
APP_VERSION: pkg.version,
...options,
}
export default CONFIG

View File

@ -105,7 +105,8 @@
"language": "Sprache",
"languages": {
"de": "Deutsch",
"en": "English"
"en": "English",
"success": "Deine Sprache wurde erfolgreich geändert."
},
"login": "Anmeldung",
"logout": "Abmelden",

View File

@ -105,7 +105,8 @@
"language": "Language",
"languages": {
"de": "Deutsch",
"en": "English"
"en": "English",
"success": "Your language has been successfully updated."
},
"login": "Login",
"logout": "Logout",

View File

@ -59,6 +59,21 @@ describe('ContentFooter', () => {
'https://github.com/gradido/gradido/releases/latest',
)
})
it('has last commit hash', async () => {
wrapper.setData({ shortHash: 'ACCEDED' })
wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' })
await wrapper.vm.$nextTick()
expect(wrapper.find('div.copyright').findAll('a').at(2).text()).toEqual('(ACCEDED)')
})
it('links to last release commit', async () => {
wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' })
await wrapper.vm.$nextTick()
expect(wrapper.find('div.copyright').findAll('a').at(2).attributes('href')).toEqual(
'https://github.com/gradido/gradido/commit/ACCEDEDC001D00DC001D00DC001D00DC001CAFA',
)
})
})
describe('links to gradido.net', () => {

View File

@ -15,6 +15,13 @@
<a href="https://github.com/gradido/gradido/releases/latest" target="_blank">
App version {{ version }}
</a>
<a
v-if="hash"
:href="'https://github.com/gradido/gradido/commit/' + hash"
target="_blank"
>
({{ shortHash }})
</a>
</div>
</b-col>
</b-row>
@ -59,6 +66,8 @@ export default {
return {
year: new Date().getFullYear(),
version: CONFIG.APP_VERSION,
hash: CONFIG.BUILD_COMMIT,
shortHash: CONFIG.BUILD_COMMIT_SHORT,
}
},
}

View File

@ -23,7 +23,7 @@
<b>{{ $t('language') }}</b>
</small>
</b-col>
<b-col class="col-12">{{ $store.state.language }}</b-col>
<b-col class="col-12">{{ $t(buildTagFromLanguageString()) }}</b-col>
</b-row>
</div>
@ -62,6 +62,7 @@
</b-card>
</template>
<script>
import { localeChanged } from 'vee-validate'
import LanguageSwitchSelect from '../../../components/LanguageSwitchSelect.vue'
import { updateUserInfos } from '../../../graphql/mutations'
import { localeChanged } from 'vee-validate'
@ -102,12 +103,17 @@ export default {
this.$i18n.locale = this.language
localeChanged(this.language)
this.cancelEdit()
this.$toasted.success(this.$t('languages.success'))
})
.catch((error) => {
this.language = this.$store.state.language
this.$toasted.error(error.message)
})
},
buildTagFromLanguageString() {
return 'languages.' + this.$store.state.language
},
},
}
</script>

View File

@ -1,5 +1,6 @@
const path = require('path')
const dotenv = require('dotenv-webpack')
const webpack = require('webpack')
const Dotenv = require('dotenv-webpack')
// vue.config.js
module.exports = {
@ -23,8 +24,17 @@ module.exports = {
assets: path.join(__dirname, 'src/assets'),
},
},
// eslint-disable-next-line new-cap
plugins: [new dotenv()],
plugins: [
new Dotenv(),
new webpack.DefinePlugin({
// Those are Environment Variables transmitted via Docker
// 'process.env.DOCKER_WORKDIR': JSON.stringify(process.env.DOCKER_WORKDIR),
// 'process.env.BUILD_DATE': JSON.stringify(process.env.BUILD_DATE),
// 'process.env.BUILD_VERSION': JSON.stringify(process.env.BUILD_VERSION),
'process.env.BUILD_COMMIT': JSON.stringify(process.env.BUILD_COMMIT),
// 'process.env.PORT': JSON.stringify(process.env.PORT),
}),
],
},
css: {
// Enable CSS source maps.

View File

@ -57,6 +57,7 @@ namespace ServerConfig {
int g_FakeLoginSleepTime = 820;
std::string g_versionString = "";
bool g_disableEmail = false;
bool g_resendUnfinishedTransactionOnStart = false;
ServerSetupType g_ServerSetupType = SERVER_TYPE_PRODUCTION;
std::string g_devDefaultGroup = "";
std::string g_gRPCRelayServerFullURL;
@ -259,23 +260,7 @@ namespace ServerConfig {
g_AllowUnsecureFlags = (AllowUnsecure)(g_AllowUnsecureFlags | UNSECURE_ALLOW_ALL_PASSWORDS);
}
g_gRPCRelayServerFullURL = cfg.getString("grpc.server", "");
// unsecure flags
//g_AllowUnsecureFlags
if (cfg.getInt("unsecure.allow_passwort_via_json_request", 0) == 1) {
g_AllowUnsecureFlags = (AllowUnsecure)(g_AllowUnsecureFlags | UNSECURE_PASSWORD_REQUESTS);
}
if (cfg.getInt("unsecure.allow_auto_sign_transactions", 0) == 1) {
g_AllowUnsecureFlags = (AllowUnsecure)(g_AllowUnsecureFlags | UNSECURE_AUTO_SIGN_TRANSACTIONS);
}
if (cfg.getInt("unsecure.allow_cors_all", 0) == 1) {
g_AllowUnsecureFlags = (AllowUnsecure)(g_AllowUnsecureFlags | UNSECURE_CORS_ALL);
}
if (cfg.getInt("unsecure.allow_all_passwords", 0) == 1) {
g_AllowUnsecureFlags = (AllowUnsecure)(g_AllowUnsecureFlags | UNSECURE_ALLOW_ALL_PASSWORDS);
}
g_resendUnfinishedTransactionOnStart = cfg.getBool("dev.resend_unfinished_transactions_on_start", false);
return true;
}

View File

@ -73,6 +73,7 @@ namespace ServerConfig {
extern int g_FakeLoginSleepTime;
extern std::string g_versionString;
extern bool g_disableEmail;
extern bool g_resendUnfinishedTransactionOnStart;
extern ServerSetupType g_ServerSetupType;
extern std::string g_devDefaultGroup;
extern std::string g_gRPCRelayServerFullURL;

View File

@ -204,7 +204,7 @@ namespace model {
}
}
// try not finished but signed transactions again
if (!finished) {
if (!finished && ServerConfig::g_resendUnfinishedTransactionOnStart) {
transaction->ifEnoughSignsProceed(nullptr);
}

View File

@ -7,7 +7,22 @@ WORKDIR /go/src/github.com/skeema/skeema
RUN go install github.com/skeema/skeema@v1.5.3
#########################################################################################################
# Run skeema
# Run skeema for dev (dynamic)
#########################################################################################################
FROM skeema_build as skeema_dev_run
ENV DOCKER_WORKDIR="/skeema"
RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
COPY ./skeema/.skeema .
COPY ./mariadb/.skeema.login .
CMD cp .skeema.login ./gradido_login/.skeema && skeema push --allow-unsafe && rm ./gradido_login/.skeema
#########################################################################################################
# Run skeema
#########################################################################################################
FROM skeema_build as skeema_run
@ -20,4 +35,5 @@ COPY ./skeema/.skeema .
COPY ./login_server/skeema/ .
COPY ./mariadb/.skeema.login ./gradido_login/.skeema
CMD skeema push --allow-unsafe
CMD skeema push --allow-unsafe