Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaile committed Mar 25, 2024
1 parent c50e7fe commit d754d21
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|
*/

'name' => env('APP_NAME', 'Laravel'),
'name' => env('APP_NAME', 'Phonehome'),

/*
|--------------------------------------------------------------------------
Expand Down
63 changes: 35 additions & 28 deletions deploy/ns8/imageroot/actions/create-module/10env
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
#!/usr/bin/env python3

#
# Copyright (C) 2022 Nethesis S.r.l.
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

import agent
import secrets
import string

agent.set_env('APP_NAME', 'PhoneHome')
agent.set_env('APP_ENV', 'production')

alphabet = string.ascii_letters + string.digits
agent.set_env('APP_KEY', ''.join(secrets.choice(alphabet) for i in range(32)))

agent.set_env('LOG_CHANNEL', 'stderr')
agent.set_env('LOG_DEPRECATIONS_CHANNEL', 'stderr')

agent.set_env('DB_CONNECTION', 'pgsql')
agent.set_env('DB_HOST', 'database')
agent.set_env('DB_PORT', '5432')
agent.set_env('DB_DATABASE', 'phonehome')
agent.set_env('DB_USERNAME', 'phonehome')
agent.set_env('DB_PASSWORD', 'phonehome')

agent.set_env('BROADCAST_DRIVER', 'redis')
agent.set_env('CACHE_DRIVER', 'redis')
agent.set_env('QUEUE_CONNECTION', 'redis')
agent.set_env('SESSION_DRIVER', 'redis')

agent.set_env('PHONEHOME_REDIS_HOST', 'redis')
agent.set_env('PHONEHOME_REDIS_PASSWORD', 'null')
import json
import os
import subprocess

app_key = subprocess.run(
[
'podman',
'run',
'--rm',
os.environ['PHONEHOME_SERVER_APP_IMAGE'],
'php',
'artisan',
'key:generate',
'--show',
],
capture_output=True,
text=True,
check=True
).stdout.strip()

json.dump(
{
'APP_KEY': app_key,
'LOG_CHANNEL': 'stderr',
'LOG_DEPRECATIONS_CHANNEL': 'stderr',
'DB_CONNECTION': 'pgsql',
'DB_HOST': 'database',
'DB_PORT': 5432,
'DB_DATABASE': 'phonehome',
'DB_USERNAME': 'phonehome',
'DB_PASSWORD': 'phonehome',
},
open('config.json', 'w')
)

0 comments on commit d754d21

Please sign in to comment.