sync build tree from private myoffice
This commit is contained in:
@@ -58,9 +58,10 @@ export class ExternalLoginConfig {
|
||||
}
|
||||
|
||||
static getAuth0Config() {
|
||||
const auth0 = environment.externalLogins?.auth0;
|
||||
return {
|
||||
clientId: environment.externalLogins.auth0.clientId,
|
||||
domain: environment.externalLogins.auth0.domain,
|
||||
clientId: auth0?.clientId || 'unused',
|
||||
domain: auth0?.domain || 'unused.auth0.com',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export function storageFactory(): OAuthStorage {
|
||||
declarations: [],
|
||||
imports: [
|
||||
CommonModule,
|
||||
SocialLoginModule,
|
||||
SocialLoginModule.initialize(ExternalLoginConfig.getSocialConfig()),
|
||||
OAuthModule.forRoot(),
|
||||
AuthModule.forRoot(ExternalLoginConfig.getAuth0Config()),
|
||||
],
|
||||
@@ -42,7 +42,6 @@ export function storageFactory(): OAuthStorage {
|
||||
{ provide: AuthConfig, useValue: AuthCodeFlowConfig },
|
||||
{ provide: OAuthModuleConfig, useValue: AuthModuleConfig },
|
||||
{ provide: OAuthStorage, useFactory: storageFactory },
|
||||
{ provide: 'SocialAuthServiceConfig', useValue: ExternalLoginConfig.getSocialConfig() },
|
||||
RightSidebarService,
|
||||
AuthGuard,
|
||||
AuthService,
|
||||
|
||||
@@ -87,19 +87,37 @@ install_aspnet_runtime() {
|
||||
}
|
||||
|
||||
setup_postgres() {
|
||||
msg "Configuring PostgreSQL"
|
||||
msg "Configuring PostgreSQL (UTF8 — required for Npgsql ICU collations)"
|
||||
systemctl enable --now postgresql
|
||||
|
||||
# Ensure locale exists before CREATE DATABASE … LC_COLLATE
|
||||
sed -i 's/^# *en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen 2>/dev/null || true
|
||||
locale-gen en_US.UTF-8 >/dev/null 2>&1 || true
|
||||
|
||||
if ! as_postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='${PG_USER}'" | grep -q 1; then
|
||||
as_postgres psql -c "CREATE USER ${PG_USER} WITH PASSWORD '${PG_PASS}';"
|
||||
else
|
||||
as_postgres psql -c "ALTER USER ${PG_USER} WITH PASSWORD '${PG_PASS}';"
|
||||
fi
|
||||
if ! as_postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='${PG_DB}'" | grep -q 1; then
|
||||
as_postgres psql -c "CREATE DATABASE ${PG_DB} OWNER ${PG_USER};"
|
||||
|
||||
local enc
|
||||
enc=$(as_postgres psql -tAc "SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname='${PG_DB}'" 2>/dev/null | tr -d '[:space:]' || true)
|
||||
if [[ -n "$enc" && "$enc" != "UTF8" ]]; then
|
||||
msg "Recreating ${PG_DB}: encoding was ${enc}, need UTF8"
|
||||
as_postgres psql -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='${PG_DB}' AND pid <> pg_backend_pid();" || true
|
||||
as_postgres psql -c "DROP DATABASE IF EXISTS ${PG_DB};"
|
||||
enc=""
|
||||
fi
|
||||
|
||||
if [[ -z "$enc" ]]; then
|
||||
as_postgres psql -c "CREATE DATABASE ${PG_DB} OWNER ${PG_USER} ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8' TEMPLATE template0;" \
|
||||
|| as_postgres psql -c "CREATE DATABASE ${PG_DB} OWNER ${PG_USER} ENCODING 'UTF8' LC_COLLATE 'C.UTF-8' LC_CTYPE 'C.UTF-8' TEMPLATE template0;"
|
||||
fi
|
||||
|
||||
as_postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ${PG_DB} TO ${PG_USER};"
|
||||
as_postgres psql -d "$PG_DB" -c "GRANT ALL ON SCHEMA public TO ${PG_USER};" || true
|
||||
msg "PostgreSQL ready (db/user/pass=${PG_DB})"
|
||||
enc=$(as_postgres psql -tAc "SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname='${PG_DB}'" | tr -d '[:space:]')
|
||||
msg "PostgreSQL ready (db/user/pass=${PG_DB}, encoding=${enc})"
|
||||
}
|
||||
|
||||
write_runtime_config() {
|
||||
|
||||
Reference in New Issue
Block a user