forked from fediversity/fediversity
		
	Pass REPO_DIR implicitly
This commit is contained in:
		
							parent
							
								
									3b6fcc2878
								
							
						
					
					
						commit
						7b6e8fa9ba
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -35,8 +35,6 @@ in
 | 
			
		|||
      export CREDENTIALS_DIRECTORY=${builtins.toString ./.credentials}
 | 
			
		||||
      export DATABASE_URL="sqlite:///${toString ./src}/db.sqlite3"
 | 
			
		||||
    '';
 | 
			
		||||
    # FIXME: ending a path in a non-name produces a double hash :(
 | 
			
		||||
    REPO_DIR = ./..;
 | 
			
		||||
    NIX_DIR = pkgs.nix;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
from enum import Enum
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from django.urls import reverse_lazy
 | 
			
		||||
import os
 | 
			
		||||
| 
						 | 
				
			
			@ -12,18 +13,23 @@ from panel import models
 | 
			
		|||
from panel.configuration import forms
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Index(TemplateView):
 | 
			
		||||
    template_name = 'index.html'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AccountDetail(LoginRequiredMixin, DetailView):
 | 
			
		||||
    model = User
 | 
			
		||||
    template_name = 'account_detail.html'
 | 
			
		||||
 | 
			
		||||
    def get_object(self):
 | 
			
		||||
        return self.request.user
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ServiceList(TemplateView):
 | 
			
		||||
    template_name = 'service_list.html'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ConfigurationForm(LoginRequiredMixin, FormView):
 | 
			
		||||
    template_name = 'configuration_form.html'
 | 
			
		||||
    success_url = reverse_lazy('configuration_form')
 | 
			
		||||
| 
						 | 
				
			
			@ -44,12 +50,14 @@ class ConfigurationForm(LoginRequiredMixin, FormView):
 | 
			
		|||
            print("DEPLOYING:")
 | 
			
		||||
            print(os.getenv("REPO_DIR"))
 | 
			
		||||
            print(os.getenv("NIX_DIR"))
 | 
			
		||||
            env={
 | 
			
		||||
            env = {
 | 
			
		||||
                "DEPLOYMENT": obj.parsed_value.model_dump_json(),
 | 
			
		||||
                "PATH": f"{os.getenv("NIX_DIR")}/bin/",
 | 
			
		||||
            }
 | 
			
		||||
            print(f"env: {env}")
 | 
			
		||||
            subprocess.run(["nix", "develop", "--command", "nixops4", "--show-trace", "--verbose", "apply", "test"], cwd=os.getenv("REPO_DIR"), env=env)
 | 
			
		||||
            print(f"Path: {os.getcwd()}/..")
 | 
			
		||||
            subprocess.run(["nix", "develop", "--command", "nixops4", "--show-trace",
 | 
			
		||||
                           "--verbose", "apply", "test"], cwd=os.getenv("REPO_DIR") or f"{os.getcwd()}/..", env=env)
 | 
			
		||||
        return obj
 | 
			
		||||
 | 
			
		||||
    # TODO(@fricklerhandwerk):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue