1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-17 11:54:22 +01:00

(bug) unable to read provider config if no file

This commit is contained in:
Sylvain 2023-03-30 10:28:31 +02:00
parent f5366f2cc1
commit 68aad57b14
3 changed files with 7 additions and 3 deletions

View File

@ -13,7 +13,7 @@ class AuthProvider < ApplicationRecord
end
def strategy_name
"database-#{name.downcase.parameterize}"
'database-simpleauthprovider'
end
end

View File

@ -3,7 +3,11 @@
# Deals with the yml file keeping the configuration of the current authentication provider
class ProviderConfig
def initialize
@config = YAML.safe_load_file('config/auth_provider.yml').with_indifferent_access if File.exist?('config/auth_provider.yml')
@config = if File.exist?('config/auth_provider.yml')
YAML.safe_load_file('config/auth_provider.yml').with_indifferent_access
else
{ providable_type: 'DatabaseProvider', name: 'DatabaseProvider::SimpleAuthProvider' }
end
end
def db

View File

@ -22,7 +22,7 @@ add_mount()
if [[ ! $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*auth_provider.yml\")" docker-compose.yml) ]]; then
# change docker-compose.yml permissions for fix yq can't modify file issue
chmod 666 docker-compose.yml
yq -i eval ".services.$SERVICE.volumes += [\"\./config/auth_provider.yml:/usr/src/app/auth_provider.yml\"]" docker-compose.yml
yq -i eval ".services.$SERVICE.volumes += [\"./config/auth_provider.yml:/usr/src/app/auth_provider.yml\"]" docker-compose.yml
chmod 644 docker-compose.yml
fi
}